blob: 7285a264d6822df2ab9483563c9f433ead74a265 [file] [log] [blame]
wdenkf5f146e2003-04-20 16:52:09 +00001/* (C) Copyright 2002
2 * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
3 *
4 * See file CREDITS for list of people who contributed to this
5 * project.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23/************************************************************************/
24/* ** Layout of a bmp file */
25/************************************************************************/
26
27#ifndef _BMP_H_
28#define _BMP_H_
29
30typedef struct bmp_color_table_entry {
31 __u8 blue;
32 __u8 green;
33 __u8 red;
34 __u8 reserved;
35} __attribute__((packed)) bmp_color_table_entry_t;
36
37/* When accessing these fields, remember that they are stored in little
38 endian format, so use linux macros, e.g. le32_to_cpu(width) */
39
40typedef struct bmp_header {
41 /* Header */
42 char signature[2];
43 __u32 file_size;
44 __u32 reserved;
45 __u32 data_offset;
46 /* InfoHeader */
47 __u32 size;
48 __u32 width;
49 __u32 height;
50 __u16 planes;
51 __u16 bit_count;
52 __u32 compression;
53 __u32 image_size;
54 __u32 x_pixels_per_m;
55 __u32 y_pixels_per_m;
56 __u32 colors_used;
57 __u32 colors_important;
58 /* ColorTable */
59
60} __attribute__((packed)) bmp_header_t;
61
62typedef struct bmp_image {
63 bmp_header_t header;
64 /* We use a zero sized array just as a placeholder for variable
65 sized array */
66 bmp_color_table_entry_t color_table[0];
67} bmp_image_t;
68
69/* Data in the bmp_image is aligned to this length */
70#define BMP_DATA_ALIGN 4
71
72/* Constants for the compression field */
73#define BMP_BI_RGB 0
74#define BMP_BI_RLE8 1
75#define BMP_BI_RLE4 2
76
77#endif /* _BMP_H_ */