bmp_layout.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* (C) Copyright 2002
  2. * Detlev Zundel, DENX Software Engineering, dzu@denx.de.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. /************************************************************************/
  7. /* ** Layout of a bmp file */
  8. /************************************************************************/
  9. #ifndef _BMP_H_
  10. #define _BMP_H_
  11. typedef struct bmp_color_table_entry {
  12. __u8 blue;
  13. __u8 green;
  14. __u8 red;
  15. __u8 reserved;
  16. } __attribute__ ((packed)) bmp_color_table_entry_t;
  17. /* When accessing these fields, remember that they are stored in little
  18. endian format, so use linux macros, e.g. le32_to_cpu(width) */
  19. typedef struct bmp_header {
  20. /* Header */
  21. char signature[2];
  22. __u32 file_size;
  23. __u32 reserved;
  24. __u32 data_offset;
  25. /* InfoHeader */
  26. __u32 size;
  27. __u32 width;
  28. __u32 height;
  29. __u16 planes;
  30. __u16 bit_count;
  31. __u32 compression;
  32. __u32 image_size;
  33. __u32 x_pixels_per_m;
  34. __u32 y_pixels_per_m;
  35. __u32 colors_used;
  36. __u32 colors_important;
  37. /* ColorTable */
  38. } __attribute__ ((packed)) bmp_header_t;
  39. typedef struct bmp_image {
  40. bmp_header_t header;
  41. /* We use a zero sized array just as a placeholder for variable
  42. sized array */
  43. bmp_color_table_entry_t color_table[0];
  44. } bmp_image_t;
  45. /* Data in the bmp_image is aligned to this length */
  46. #define BMP_DATA_ALIGN 4
  47. /* Constants for the compression field */
  48. #define BMP_BI_RGB 0
  49. #define BMP_BI_RLE8 1
  50. #define BMP_BI_RLE4 2
  51. #endif /* _BMP_H_ */