forked from WerWolv/ImHex-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmp.hexpat
51 lines (44 loc) · 803 Bytes
/
bmp.hexpat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma MIME image/bmp
#pragma endian little
struct BitmapFileHeader {
u8 bfType[2];
u32 bfSize;
u16 bfReserved1;
u16 bfReserved2;
u32 bfOffBits;
};
struct BitmapInfoHeader {
u32 biSize;
s32 biWidth;
s32 biHeight;
u16 biPlanes;
u16 biBitCount;
u32 biCompression;
u32 biSizeImage;
s32 biXPelsPerMeter;
s32 biYPelsPerMeter;
u32 biClrUsed;
u32 biClrImportant;
};
struct Colors {
u8 blue;
u8 green;
u8 red;
u8 reserved;
};
struct Bitmap {
BitmapFileHeader bmfh;
BitmapInfoHeader bmih;
if ((bmih.biBitCount != 24) && (bmih.biBitCount != 32))
{
if (bmih.biClrUsed > 0 )
Colors rgbq[bmih.biClrUsed];
else
Colors rgbq[1 << bmih.biBitCount];
}
if (bmih.biSizeImage > 0 )
u8 lineData[bmih.biSizeImage];
else
u8 lineData[bmfh.bfSize - $];
};
Bitmap bitmap @ 0x00;