LibGd
2.4.0-dev
GD Graphics library
Loading...
Searching...
No Matches
src
bmp.h
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_WINDOWS_V2 52
29
#define BMP_WINDOWS_V3_ALPHA 56
30
#define BMP_OS2_V1 12
31
#define BMP_OS2_V2_SHORT 16
32
#define BMP_OS2_V2 64
33
#define BMP_WINDOWS_V4 108
34
#define BMP_WINDOWS_V5 124
35
36
#define BMP_BI_RGB 0
37
#define BMP_BI_RLE8 1
38
#define BMP_BI_RLE4 2
39
#define BMP_BI_BITFIELDS 3
40
#define BMP_BI_JPEG 4
41
#define BMP_BI_PNG 5
42
#define BMP_BI_ALPHABITFIELDS 6
43
44
#define BMP_RLE_COMMAND 0
45
#define BMP_RLE_ENDOFLINE 0
46
#define BMP_RLE_ENDOFBITMAP 1
47
#define BMP_RLE_DELTA 2
48
49
#define BMP_RLE_TYPE_RAW 0
50
#define BMP_RLE_TYPE_RLE 1
51
52
/* BMP header. */
53
typedef
struct
{
54
/* 16 bit - header identifying the type */
55
signed
short
int
magic;
56
57
/* 32bit - size of the file */
58
int
size;
59
60
/* 16bit - these two are in the spec but "reserved" */
61
signed
short
int
reserved1;
62
signed
short
int
reserved2;
63
64
/* 32 bit - offset of the bitmap header from data in bytes */
65
signed
int
off;
66
67
} bmp_hdr_t;
68
69
/* BMP info. */
70
typedef
struct
{
71
/* 16bit - Type, ie Windows or OS/2 for the palette info */
72
signed
short
int
type;
73
/* 32bit - The length of the bitmap information header in bytes. */
74
signed
int
len;
75
76
/* 32bit - The width of the bitmap in pixels. */
77
signed
int
width;
78
79
/* 32bit - The height of the bitmap in pixels. */
80
signed
int
height;
81
82
/* 8 bit - The bitmap data is specified in top-down order. */
83
signed
char
topdown;
84
85
/* 16 bit - The number of planes. This must be set to a value of one. */
86
signed
short
int
numplanes;
87
88
/* 16 bit - The number of bits per pixel. */
89
signed
short
int
depth;
90
91
/* 32bit - The type of compression used. */
92
signed
int
enctype;
93
94
/* 32bit - The size of the image in bytes. */
95
signed
int
size;
96
97
/* 32bit - The horizontal resolution in pixels/metre. */
98
signed
int
hres;
99
100
/* 32bit - The vertical resolution in pixels/metre. */
101
signed
int
vres;
102
103
/* 32bit - The number of color indices used by the bitmap. */
104
signed
int
numcolors;
105
106
/* 32bit - The number of color indices important for displaying the bitmap.
107
*/
108
signed
int
mincolors;
109
110
/* 32bit - Color masks for BI_BITFIELDS and v4/v5 headers. */
111
unsigned
int
red_mask;
112
unsigned
int
green_mask;
113
unsigned
int
blue_mask;
114
unsigned
int
alpha_mask;
115
116
} bmp_info_t;
117
118
#ifdef __cplusplus
119
}
120
#endif
121
122
#endif
Generated by
1.9.8