Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 2 | /* (C) Copyright 2002 |
| 3 | * Detlev Zundel, DENX Software Engineering, dzu@denx.de. |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | /************************************************************************/ |
| 7 | /* ** Layout of a bmp file */ |
| 8 | /************************************************************************/ |
| 9 | |
| 10 | #ifndef _BMP_H_ |
| 11 | #define _BMP_H_ |
| 12 | |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 13 | struct __packed bmp_color_table_entry { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 14 | __u8 blue; |
| 15 | __u8 green; |
| 16 | __u8 red; |
| 17 | __u8 reserved; |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 18 | }; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 19 | |
| 20 | /* When accessing these fields, remember that they are stored in little |
| 21 | endian format, so use linux macros, e.g. le32_to_cpu(width) */ |
| 22 | |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 23 | struct __packed bmp_header { |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 24 | /* Header */ |
| 25 | char signature[2]; |
| 26 | __u32 file_size; |
| 27 | __u32 reserved; |
| 28 | __u32 data_offset; |
| 29 | /* InfoHeader */ |
| 30 | __u32 size; |
| 31 | __u32 width; |
| 32 | __u32 height; |
| 33 | __u16 planes; |
| 34 | __u16 bit_count; |
| 35 | __u32 compression; |
| 36 | __u32 image_size; |
| 37 | __u32 x_pixels_per_m; |
| 38 | __u32 y_pixels_per_m; |
| 39 | __u32 colors_used; |
| 40 | __u32 colors_important; |
| 41 | /* ColorTable */ |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 42 | }; |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 43 | |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 44 | struct bmp_image { |
| 45 | struct bmp_header header; |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 46 | /* We use a zero sized array just as a placeholder for variable |
| 47 | sized array */ |
Simon Glass | 1c3dbe5 | 2015-05-13 07:02:27 -0600 | [diff] [blame] | 48 | struct bmp_color_table_entry color_table[0]; |
| 49 | }; |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 50 | |
| 51 | /* Data in the bmp_image is aligned to this length */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 52 | #define BMP_DATA_ALIGN 4 |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 53 | |
| 54 | /* Constants for the compression field */ |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 55 | #define BMP_BI_RGB 0 |
| 56 | #define BMP_BI_RLE8 1 |
| 57 | #define BMP_BI_RLE4 2 |
wdenk | 059ae17 | 2003-04-20 16:52:09 +0000 | [diff] [blame] | 58 | |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 59 | #endif /* _BMP_H_ */ |