From ed97e9bd722361905db6551be29d77914faa741e Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Thu, 22 Oct 2020 17:08:45 +0200 Subject: [PATCH] source/Graphics/Image/Format/bmp.h --- source/Graphics/Image/Format/bmp.h | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 source/Graphics/Image/Format/bmp.h diff --git a/source/Graphics/Image/Format/bmp.h b/source/Graphics/Image/Format/bmp.h new file mode 100644 index 0000000..db59a2c --- /dev/null +++ b/source/Graphics/Image/Format/bmp.h @@ -0,0 +1,37 @@ + +#ifndef SPECTRE_GRAPHICS_IMAGE_FORMAT_BMP_H +#define SPECTRE_GRAPHICS_IMAGE_FORMAT_BMP_H + +#define BMP_MAGIC 0x4D42 /* "BM" in little endian */ + +/** + * Bitmap information header (DIB) + */ +struct BMP_DIB { + uint32_t size; // Size of header (40 bytes) + uint32_t width; + uint32_t height; + uint16_t planes; + uint16_t bits_per_pixel; + uint32_t compression; // See compression method constants below. + int32_t x_ppm; // Pixels per meter + int32_t y_ppm; // Pixels per meter + uint32_t colors_used; + uint32_t colors_important; +}; + +/** + * Compression method constants. + */ +#define BI_RGB 0 +#define BI_RLE8 1 +#define BI_RLE4 2 +#define BI_BITFIELDS 3 +#define BI_JPEG 4 /* RLE-24 */ +#define BI_PNG 5 +#define BI_ALPHABITFIELDS 6 +#define BI_CMYK 11 +#define BI_CMYKRLE8 12 +#define BI_CMYKRLE4 13 + +#endif /* SPECTRE_GRAPHICS_IMAGE_FORMAT_BMP_H */