bmp_layout.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* (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. /* ** Layout of a bmp file */
  24. /************************************************************************/
  25. #ifndef _BMP_H_
  26. #define _BMP_H_
  27. typedef struct bmp_color_table_entry {
  28. __u8 blue;
  29. __u8 green;
  30. __u8 red;
  31. __u8 reserved;
  32. } __attribute__ ((packed)) bmp_color_table_entry_t;
  33. /* When accessing these fields, remember that they are stored in little
  34. endian format, so use linux macros, e.g. le32_to_cpu(width) */
  35. typedef struct bmp_header {
  36. /* Header */
  37. char signature[2];
  38. __u32 file_size;
  39. __u32 reserved;
  40. __u32 data_offset;
  41. /* InfoHeader */
  42. __u32 size;
  43. __u32 width;
  44. __u32 height;
  45. __u16 planes;
  46. __u16 bit_count;
  47. __u32 compression;
  48. __u32 image_size;
  49. __u32 x_pixels_per_m;
  50. __u32 y_pixels_per_m;
  51. __u32 colors_used;
  52. __u32 colors_important;
  53. /* ColorTable */
  54. } __attribute__ ((packed)) bmp_header_t;
  55. typedef struct bmp_image {
  56. bmp_header_t header;
  57. /* We use a zero sized array just as a placeholder for variable
  58. sized array */
  59. bmp_color_table_entry_t color_table[0];
  60. } bmp_image_t;
  61. /* Data in the bmp_image is aligned to this length */
  62. #define BMP_DATA_ALIGN 4
  63. /* Constants for the compression field */
  64. #define BMP_BI_RGB 0
  65. #define BMP_BI_RLE8 1
  66. #define BMP_BI_RLE4 2
  67. #endif /* _BMP_H_ */