48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#ifndef GAME_BMPLOADER_H
|
|
#define GAME_BMPLOADER_H
|
|
|
|
#include <cstddef>
|
|
#include "../graphics/Bitmap.h"
|
|
|
|
namespace Bmp {
|
|
struct BmpFileHeader {
|
|
uint16_t signature;
|
|
uint32_t fileSize;
|
|
uint16_t reserved1;
|
|
uint16_t reserved2;
|
|
uint32_t offset;
|
|
} __attribute__((__packed__));
|
|
|
|
struct BmpInfoHeader {
|
|
uint32_t headerSize;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
uint16_t planes;
|
|
uint16_t bitsPerPixel;
|
|
uint32_t compression;
|
|
uint32_t imageSize;
|
|
uint32_t horizontalResolution;
|
|
uint32_t verticalResolution;
|
|
uint32_t colorsUsed;
|
|
uint32_t colorsImportant;
|
|
|
|
enum CompressionType {
|
|
Rgb = 0,
|
|
Rle8,
|
|
Rle4,
|
|
Bitfields,
|
|
Jpeg,
|
|
Png,
|
|
Alphabitfields,
|
|
Cmyk,
|
|
CmykRle8,
|
|
CmykRle4,
|
|
};
|
|
} __attribute__((__packed__));
|
|
|
|
Bitmap loadFromMemory(void *buf, size_t len);
|
|
Bitmap loadFromFile(const char* path);
|
|
};
|
|
|
|
|
|
#endif //GAME_BMPLOADER_H
|