bitblt.h

Wed, 02 Jan 2002 16:39:39 +0000

author
eric
date
Wed, 02 Jan 2002 16:39:39 +0000
changeset 42
9c85a4cd88a3
parent 35
41804cc569ab
child 43
b80cb5a4282a
permissions
-rw-r--r--

started work on bitblt optimization - split rotate functions from bitblt.

eric@2 1 typedef struct Point
eric@2 2 {
eric@35 3 s32 x;
eric@35 4 s32 y;
eric@2 5 } Point;
eric@2 6
eric@2 7 typedef struct Rect
eric@2 8 {
eric@42 9 Point min;
eric@42 10 Point max;
eric@2 11 } Rect;
eric@2 12
eric@42 13 static inline s32 rect_width (Rect *r)
eric@42 14 {
eric@42 15 return (r->max.x - r->min.x);
eric@42 16 }
eric@42 17
eric@42 18 static inline s32 rect_height (Rect *r)
eric@42 19 {
eric@42 20 return (r->max.y - r->min.y);
eric@42 21 }
eric@42 22
eric@2 23 typedef struct Bitmap
eric@2 24 {
eric@2 25 u8 *bits;
eric@42 26 Rect rect;
eric@2 27 u32 rowbytes;
eric@2 28 } Bitmap;
eric@2 29
eric@2 30
eric@2 31 #define TF_SRC 0xc
eric@2 32 #define TF_AND 0x8
eric@2 33 #define TF_OR 0xe
eric@2 34 #define TF_XOR 0x6
eric@2 35
eric@2 36
eric@42 37 Bitmap *create_bitmap (Rect *rect);
eric@42 38 void free_bitmap (Bitmap *bitmap);
eric@3 39
eric@2 40 boolean get_pixel (Bitmap *bitmap, Point coord);
eric@2 41 void set_pixel (Bitmap *bitmap, Point coord, boolean value);
eric@2 42
eric@42 43
eric@2 44 Bitmap *bitblt (Bitmap *src_bitmap,
eric@42 45 Rect *src_rect,
eric@2 46 Bitmap *dest_bitmap,
eric@42 47 Point *dest_min,
eric@2 48 int tfn);
eric@42 49
eric@42 50
eric@42 51 /* in-place transformations */
eric@42 52 void flip_h (Bitmap *src);
eric@42 53 void flip_v (Bitmap *src);
eric@42 54
eric@42 55 void rot_180 (Bitmap *src); /* combination of flip_h and flip_v */
eric@42 56
eric@42 57 /* "in-place" transformations - will allocate new memory and free old */
eric@42 58 void transpose (Bitmap *src);
eric@42 59
eric@42 60 void rot_90 (Bitmap *src); /* transpose + flip_h */
eric@42 61 void rot_270 (Bitmap *src); /* transpose + flip_v */