bitblt.h

Mon, 26 Aug 2002 05:43:49 +0000

author
eric
date
Mon, 26 Aug 2002 05:43:49 +0000
changeset 47
bfc6aaa089b0
parent 43
b80cb5a4282a
child 48
3d0be1c1c1b2
permissions
-rw-r--r--

fixed 'middle-endian' output from TIFFReadScanline

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@47 23
eric@43 24 typedef u32 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@43 33 u32 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@2 46 boolean get_pixel (Bitmap *bitmap, Point coord);
eric@2 47 void set_pixel (Bitmap *bitmap, Point coord, boolean 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@47 71 void reverse_bits (u8 *p, int byte_count);