bitblt.h

changeset 42
9c85a4cd88a3
parent 35
41804cc569ab
child 43
b80cb5a4282a
     1.1 --- a/bitblt.h	Wed Jan 02 16:39:20 2002 +0000
     1.2 +++ b/bitblt.h	Wed Jan 02 16:39:39 2002 +0000
     1.3 @@ -6,15 +6,24 @@
     1.4  
     1.5  typedef struct Rect
     1.6  {
     1.7 -  Point upper_left;
     1.8 -  Point lower_right;
     1.9 +  Point min;
    1.10 +  Point max;
    1.11  } Rect;
    1.12  
    1.13 +static inline s32 rect_width (Rect *r)
    1.14 +{
    1.15 +  return (r->max.x - r->min.x);
    1.16 +}
    1.17 +
    1.18 +static inline s32 rect_height (Rect *r)
    1.19 +{
    1.20 +  return (r->max.y - r->min.y);
    1.21 +}
    1.22 +
    1.23  typedef struct Bitmap
    1.24  {
    1.25    u8 *bits;
    1.26 -  s32 width;
    1.27 -  s32 height;
    1.28 +  Rect rect;
    1.29    u32 rowbytes;
    1.30  } Bitmap;
    1.31  
    1.32 @@ -25,24 +34,28 @@
    1.33  #define TF_XOR 0x6
    1.34  
    1.35  
    1.36 -#define FLIP_H    0x1
    1.37 -#define FLIP_V    0x2
    1.38 -#define TRANSPOSE 0x4
    1.39 +Bitmap *create_bitmap (Rect *rect);
    1.40 +void free_bitmap (Bitmap *bitmap);
    1.41  
    1.42 -#define ROT_0     0x0
    1.43 -#define ROT_90    (TRANSPOSE + FLIP_H)
    1.44 -#define ROT_180   (FLIP_H + FLIP_V)
    1.45 -#define ROT_270   (TRANSPOSE + FLIP_V)
    1.46 -
    1.47 -
    1.48 -Bitmap *create_bitmap (s32 width, s32 height);
    1.49 -void free_bitmap (Bitmap *bitmap);
    1.50  boolean get_pixel (Bitmap *bitmap, Point coord);
    1.51  void set_pixel (Bitmap *bitmap, Point coord, boolean value);
    1.52  
    1.53 +
    1.54  Bitmap *bitblt (Bitmap *src_bitmap,
    1.55 -		Rect src_rect,
    1.56 +		Rect   *src_rect,
    1.57  		Bitmap *dest_bitmap,
    1.58 -		Point dest_upper_left,
    1.59 -		int scan,
    1.60 +		Point  *dest_min,
    1.61  		int tfn);
    1.62 +
    1.63 +
    1.64 +/* in-place transformations */
    1.65 +void flip_h (Bitmap *src);
    1.66 +void flip_v (Bitmap *src);
    1.67 +
    1.68 +void rot_180 (Bitmap *src);  /* combination of flip_h and flip_v */
    1.69 +
    1.70 +/* "in-place" transformations - will allocate new memory and free old */
    1.71 +void transpose (Bitmap *src);
    1.72 +
    1.73 +void rot_90 (Bitmap *src);   /* transpose + flip_h */
    1.74 +void rot_270 (Bitmap *src);  /* transpose + flip_v */