bmp_layout.h 1.3 KB

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