bitblt.h

Tue, 21 Jan 2003 18:53:48 +0000

author
eric
date
Tue, 21 Jan 2003 18:53:48 +0000
changeset 51
3398476bbedd
parent 48
3d0be1c1c1b2
child 53
bb180150e603
permissions
-rw-r--r--

added 'dist' target, and minor cleanup

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