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