bmp.h 1.0 KB

1234567891011121314151617181920212223242526272829
  1. #ifndef _BMP_H_
  2. #define _BMP_H_
  3. #include <stdint.h>
  4. #include <stdbool.h>
  5. #include <stdio.h>
  6. typedef struct __attribute__((packed))
  7. {
  8. uint16_t type; // Magic identifier: 0x4d42
  9. uint32_t size; // File size in bytes
  10. uint16_t reserved1; // Not used
  11. uint16_t reserved2; // Not used
  12. uint32_t offset; // Offset to image data in bytes from beginning of file
  13. uint32_t dib_header_size; // DIB Header size in bytes
  14. int32_t width_px; // Width of the image
  15. int32_t height_px; // Height of image
  16. uint16_t num_planes; // Number of color planes
  17. uint16_t bits_per_pixel; // Bits per pixel
  18. uint32_t compression; // Compression type
  19. uint32_t image_size_bytes; // Image size in bytes
  20. int32_t x_resolution_ppm; // Pixels per meter
  21. int32_t y_resolution_ppm; // Pixels per meter
  22. uint32_t num_colors; // Number of colors
  23. uint32_t important_colors; // Important colors
  24. } BMPHeader;
  25. #endif //_BMP_H_