2 * Windows BMP file definitions for OpenGL.
4 * Written by Michael Sweet.
11 * Include necessary headers.
21 * Make this header file work with C and C++ source code...
26 # endif /* __cplusplus */
30 * Bitmap file data structures (these are defined in <wingdi.h> under
33 * Note that most Windows compilers will pack the following structures, so
34 * when reading them under MacOS or UNIX we need to read individual fields
35 * to avoid differences in alignment...
39 typedef struct /**** BMP file header structure ****/
41 unsigned short bfType; /* Magic number for file */
42 unsigned int bfSize; /* Size of file */
43 unsigned short bfReserved1; /* Reserved */
44 unsigned short bfReserved2; /* ... */
45 unsigned int bfOffBits; /* Offset to bitmap data */
48 # define BF_TYPE 0x4D42 /* "MB" */
50 typedef struct /**** BMP file info structure ****/
52 unsigned int biSize; /* Size of info header */
53 int biWidth; /* Width of image */
54 int biHeight; /* Height of image */
55 unsigned short biPlanes; /* Number of color planes */
56 unsigned short biBitCount; /* Number of bits per pixel */
57 unsigned int biCompression; /* Type of compression to use */
58 unsigned int biSizeImage; /* Size of image data */
59 int biXPelsPerMeter; /* X pixels per meter */
60 int biYPelsPerMeter; /* Y pixels per meter */
61 unsigned int biClrUsed; /* Number of colors used */
62 unsigned int biClrImportant; /* Number of important colors */
66 * Constants for the biCompression field...
69 # define BI_RGB 0 /* No compression - straight BGR data */
70 # define BI_RLE8 1 /* 8-bit run-length compression */
71 # define BI_RLE4 2 /* 4-bit run-length compression */
72 # define BI_BITFIELDS 3 /* RGB bitmap with RGB masks */
74 typedef struct /**** Colormap entry structure ****/
76 unsigned char rgbBlue; /* Blue value */
77 unsigned char rgbGreen; /* Green value */
78 unsigned char rgbRed; /* Red value */
79 unsigned char rgbReserved; /* Reserved */
82 typedef struct /**** Bitmap information structure ****/
84 BITMAPINFOHEADER bmiHeader; /* Image header */
85 RGBQUAD bmiColors[256]; /* Image colormap */
93 extern GLubyte *LoadDIBitmap(const char *filename, BITMAPINFO **info);
94 extern int SaveDIBitmap(const char *filename, BITMAPINFO *info,
99 # endif /* __cplusplus */
100 #endif /* !_BITMAP_H_ */