1 #ifndef BMP_H 2 #define BMP_H 1 3 4 #ifdef __cplusplus 5 extern "C" { 6 #endif 7 8 /* 9 gd_bmp.c 10 11 Bitmap format support for libgd 12 13 * Written 2007, Scott MacVicar 14 --------------------------------------------------------------------------- 15 16 Todo: 17 18 RLE4, RLE8 and Bitfield encoding 19 Add full support for Windows v4 and Windows v5 header formats 20 21 ---------------------------------------------------------------------------- 22 */ 23 24 #define BMP_PALETTE_3 1 25 #define BMP_PALETTE_4 2 26 27 #define BMP_WINDOWS_V3 40 28 #define BMP_OS2_V1 12 29 #define BMP_OS2_V2 64 30 #define BMP_WINDOWS_V4 108 31 #define BMP_WINDOWS_V5 124 32 33 #define BMP_BI_RGB 0 34 #define BMP_BI_RLE8 1 35 #define BMP_BI_RLE4 2 36 #define BMP_BI_BITFIELDS 3 37 #define BMP_BI_JPEG 4 38 #define BMP_BI_PNG 5 39 40 #define BMP_RLE_COMMAND 0 41 #define BMP_RLE_ENDOFLINE 0 42 #define BMP_RLE_ENDOFBITMAP 1 43 #define BMP_RLE_DELTA 2 44 45 #define BMP_RLE_TYPE_RAW 0 46 #define BMP_RLE_TYPE_RLE 1 47 48 /* BMP header. */ 49 typedef struct { 50 /* 16 bit - header identifying the type */ 51 signed short int magic; 52 53 /* 32bit - size of the file */ 54 int size; 55 56 /* 16bit - these two are in the spec but "reserved" */ 57 signed short int reserved1; 58 signed short int reserved2; 59 60 /* 32 bit - offset of the bitmap header from data in bytes */ 61 signed int off; 62 63 } bmp_hdr_t; 64 65 /* BMP info. */ 66 typedef struct { 67 /* 16bit - Type, ie Windows or OS/2 for the palette info */ 68 signed short int type; 69 /* 32bit - The length of the bitmap information header in bytes. */ 70 signed int len; 71 72 /* 32bit - The width of the bitmap in pixels. */ 73 signed int width; 74 75 /* 32bit - The height of the bitmap in pixels. */ 76 signed int height; 77 78 /* 8 bit - The bitmap data is specified in top-down order. */ 79 signed char topdown; 80 81 /* 16 bit - The number of planes. This must be set to a value of one. */ 82 signed short int numplanes; 83 84 /* 16 bit - The number of bits per pixel. */ 85 signed short int depth; 86 87 /* 32bit - The type of compression used. */ 88 signed int enctype; 89 90 /* 32bit - The size of the image in bytes. */ 91 signed int size; 92 93 /* 32bit - The horizontal resolution in pixels/metre. */ 94 signed int hres; 95 96 /* 32bit - The vertical resolution in pixels/metre. */ 97 signed int vres; 98 99 /* 32bit - The number of color indices used by the bitmap. */ 100 signed int numcolors; 101 102 /* 32bit - The number of color indices important for displaying the bitmap. */ 103 signed int mincolors; 104 105 } bmp_info_t; 106 107 #ifdef __cplusplus 108 } 109 #endif 110 111 #endif 112