bmp_layout.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. struct __packed bmp_color_table_entry {
  12. __u8 blue;
  13. __u8 green;
  14. __u8 red;
  15. __u8 reserved;
  16. };
  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. struct __packed 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. };
  39. struct bmp_image {
  40. struct bmp_header header;
  41. /* We use a zero sized array just as a placeholder for variable
  42. sized array */
  43. struct bmp_color_table_entry color_table[0];
  44. };
  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_ */