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