Makefile: don't link all objs to all programs
[rofl0r-agsutils.git] / Bitmap.h
bloba49eaa80875ae5c056dc56a4dea48ba43a2dc117
1 #ifndef BITMAP_H
2 #define BITMAP_H
4 #define WORD unsigned short
5 #define DWORD unsigned int
6 #define LONG DWORD
8 #define M_BITMAPFILEHEADER \
9 WORD bfType ; /* signature word "BM" or 0x4D42 */ \
10 DWORD bfSize ; /* entire size of file */ \
11 WORD bfReserved1 ; /* must be zero */ \
12 WORD bfReserved2 ; /* must be zero */ \
13 DWORD bfOffsetBits ; /* offset in file of DIB pixel bits */ \
15 /* note: original had biWidth/Height as WORD, thus size 12 */
16 #define M_BITMAPCOREHEADER \
17 DWORD biSize ; /* size of the structure = 12 */ \
18 LONG biWidth ; /* width of image in pixels */ \
19 LONG biHeight ; /* height of image in pixels */ \
20 WORD biPlanes ; /* = 1 */ \
21 WORD biBitCount ; /* bits per pixel (1, 4, 8, or 24) */ \
23 #define M_BITMAPINFOHEADER \
24 M_BITMAPCOREHEADER \
25 DWORD biCompression ; /* compression code */ \
26 DWORD biSizeImage ; /* number of bytes in image */ \
27 LONG biXPelsPerMeter ; /* horizontal resolution */ \
28 LONG biYPelsPerMeter ; /* vertical resolution */ \
29 DWORD biClrUsed ; /* number of colors used */ \
30 DWORD biClrImportant ; /* number of important colors */ \
32 #define M_BITMAPV2INFOHEADER \
33 M_BITMAPINFOHEADER \
34 DWORD biRedMask ; /* Red color mask */ \
35 DWORD biGreenMask ; /* Green color mask */ \
36 DWORD biBlueMask ; /* Blue color mask */ \
38 #define M_BITMAPV3INFOHEADER \
39 M_BITMAPV2INFOHEADER \
40 DWORD biAlphaMask ; /* Alpha mask */ \
42 #define M_BITMAPV4HEADER \
43 M_BITMAPV3INFOHEADER \
44 DWORD biCSType ; /* color space type */ \
45 LONG biRedX; /* X coordinate of red endpoint */ \
46 LONG biRedY; /* Y coordinate of red endpoint */ \
47 LONG biRedZ; /* Z coordinate of red endpoint */ \
48 LONG biGreenX; /* X coordinate of green endpoint */ \
49 LONG biGreenY; /* Y coordinate of green endpoint */ \
50 LONG biGreenZ; /* Z coordinate of green endpoint */ \
51 LONG biBlueX; /* X coordinate of blue endpoint */ \
52 LONG biBlueY; /* Y coordinate of blue endpoint */ \
53 LONG biBlueZ; /* Z coordinate of blue endpoint */ \
54 DWORD biGammaRed ; /* Red gamma value */ \
55 DWORD biGammaGreen ; /* Green gamma value */ \
56 DWORD biGammaBlue ; /* Blue gamma value */ \
58 #define M_BITMAPV5HEADER \
59 M_BITMAPV4HEADER \
60 DWORD biIntent ; /* rendering intent */ \
61 DWORD biProfileData ; /* profile data or filename */ \
62 DWORD biProfileSize ; /* size of embedded data or filename */\
63 DWORD biReserved ; \
65 #define BMP_STRUCT_DECL(X) \
66 struct X { \
67 M_ ## X \
68 } __attribute__((packed, aligned(2)))
70 BMP_STRUCT_DECL(BITMAPFILEHEADER);
71 BMP_STRUCT_DECL(BITMAPCOREHEADER);
72 BMP_STRUCT_DECL(BITMAPINFOHEADER);
73 BMP_STRUCT_DECL(BITMAPV2INFOHEADER);
74 BMP_STRUCT_DECL(BITMAPV3INFOHEADER);
75 BMP_STRUCT_DECL(BITMAPV4HEADER);
76 BMP_STRUCT_DECL(BITMAPV5HEADER);
78 #undef BMP_STRUCT_DECL
80 #define BMP_STRUCT_DECL_X(X) \
81 struct X ## _X { \
82 M_BITMAPFILEHEADER \
83 M_ ## X \
84 } __attribute__((packed, aligned (2)))
87 BMP_STRUCT_DECL_X(BITMAPCOREHEADER);
88 BMP_STRUCT_DECL_X(BITMAPINFOHEADER);
89 BMP_STRUCT_DECL_X(BITMAPV2INFOHEADER);
90 BMP_STRUCT_DECL_X(BITMAPV3INFOHEADER);
91 BMP_STRUCT_DECL_X(BITMAPV4HEADER);
92 BMP_STRUCT_DECL_X(BITMAPV5HEADER);
94 #undef BMP_STRUCT_DECL_X
96 #endif