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