blob: d823de910fb748019d6c415510ddb499a482cf68 [file] [log] [blame]
wdenk059ae172003-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 {
wdenk27b207f2003-07-24 23:38:38 +000031 __u8 blue;
32 __u8 green;
33 __u8 red;
34 __u8 reserved;
35} __attribute__ ((packed)) bmp_color_table_entry_t;
wdenk059ae172003-04-20 16:52:09 +000036
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
wdenk27b207f2003-07-24 23:38:38 +000040typedef 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 */
wdenk8bde7f72003-06-27 21:31:46 +000059
wdenk27b207f2003-07-24 23:38:38 +000060} __attribute__ ((packed)) bmp_header_t;
wdenk059ae172003-04-20 16:52:09 +000061
62typedef struct bmp_image {
wdenk27b207f2003-07-24 23:38:38 +000063 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];
wdenk059ae172003-04-20 16:52:09 +000067} bmp_image_t;
68
69/* Data in the bmp_image is aligned to this length */
wdenk27b207f2003-07-24 23:38:38 +000070#define BMP_DATA_ALIGN 4
wdenk059ae172003-04-20 16:52:09 +000071
72/* Constants for the compression field */
wdenk27b207f2003-07-24 23:38:38 +000073#define BMP_BI_RGB 0
74#define BMP_BI_RLE8 1
75#define BMP_BI_RLE4 2
wdenk059ae172003-04-20 16:52:09 +000076
wdenk27b207f2003-07-24 23:38:38 +000077#endif /* _BMP_H_ */