603c11da3014d4b02539ff5126724a1adf28d827
[dosdemo] / src / gfxutil.h
1 #ifndef GFXUTIL_H_
2 #define GFXUTIL_H_
3
4 #define PACK_RGB16(r, g, b) \
5         (((((r) >> 3) & 0x1f) << 11) | ((((g) >> 2) & 0x3f) << 5) | (((b) >> 3) & 0x1f))
6
7 #define UNPACK_R16(c)   (((c) >> 8) & 0xf8)
8 #define UNPACK_G16(c)   (((c) >> 3) & 0xfc)
9 #define UNPACK_B16(c)   (((c) << 3) & 0xf8)
10
11 #define PACK_RGB32(r, g, b) \
12         ((((r) & 0xff) << 16) | (((g) & 0xff) << 8) | ((b) & 0xff))
13
14 int clip_line(int *x0, int *y0, int *x1, int *y1, int xmin, int ymin, int xmax, int ymax);
15 void draw_line(int x0, int y0, int x1, int y1, unsigned short color);
16
17 #endif  /* GFXUTIL_H_ */