bitblt.h

Tue, 21 Jan 2003 18:39:55 +0000

author
eric
date
Tue, 21 Jan 2003 18:39:55 +0000
changeset 50
efbc5e0957df
parent 48
3d0be1c1c1b2
child 53
bb180150e603
permissions
-rw-r--r--

output copyright message and URL before usage message

eric@2 1 typedef struct Point
eric@2 2 {
eric@48 3 int32_t x;
eric@48 4 int32_t 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@48 13 static inline int32_t rect_width (Rect *r)
eric@42 14 {
eric@42 15 return (r->max.x - r->min.x);
eric@42 16 }
eric@42 17
eric@48 18 static inline int32_t rect_height (Rect *r)
eric@42 19 {
eric@42 20 return (r->max.y - r->min.y);
eric@42 21 }
eric@42 22
eric@47 23
eric@48 24 typedef uint32_t word_type;
eric@47 25 #define BITS_PER_WORD (8 * sizeof (word_type))
eric@47 26 #define ALL_ONES (~ 0U)
eric@47 27
eric@43 28
eric@2 29 typedef struct Bitmap
eric@2 30 {
eric@43 31 word_type *bits;
eric@42 32 Rect rect;
eric@48 33 uint32_t row_words;
eric@2 34 } Bitmap;
eric@2 35
eric@2 36
eric@2 37 #define TF_SRC 0xc
eric@2 38 #define TF_AND 0x8
eric@2 39 #define TF_OR 0xe
eric@2 40 #define TF_XOR 0x6
eric@2 41
eric@2 42
eric@42 43 Bitmap *create_bitmap (Rect *rect);
eric@42 44 void free_bitmap (Bitmap *bitmap);
eric@3 45
eric@48 46 bool get_pixel (Bitmap *bitmap, Point coord);
eric@48 47 void set_pixel (Bitmap *bitmap, Point coord, bool value);
eric@2 48
eric@42 49
eric@2 50 Bitmap *bitblt (Bitmap *src_bitmap,
eric@42 51 Rect *src_rect,
eric@2 52 Bitmap *dest_bitmap,
eric@42 53 Point *dest_min,
eric@43 54 int tfn,
eric@43 55 int background);
eric@42 56
eric@42 57
eric@42 58 /* in-place transformations */
eric@42 59 void flip_h (Bitmap *src);
eric@42 60 void flip_v (Bitmap *src);
eric@42 61
eric@42 62 void rot_180 (Bitmap *src); /* combination of flip_h and flip_v */
eric@42 63
eric@42 64 /* "in-place" transformations - will allocate new memory and free old */
eric@42 65 void transpose (Bitmap *src);
eric@42 66
eric@42 67 void rot_90 (Bitmap *src); /* transpose + flip_h */
eric@42 68 void rot_270 (Bitmap *src); /* transpose + flip_v */
eric@47 69
eric@47 70
eric@48 71 void reverse_bits (uint8_t *p, int byte_count);