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