2017年12月20日水曜日

[C/C++] 點陣 bitmap 的 header 格式

這篇沒什麼特別的內容。

只是記錄一下 1 bit 的點陣圖格式。

B/W 1 bit 的點陣圖 header 是 62 Bytes 不是 64 Bytes。

#pragma pack(push, 1)

typedef struct tagBITMAPHEADER

{

WORD type;
DWORD bmp_file_size;
WORD reserved_1;
WORD reserved_2;
DWORD offset;


DWORD header_size; // 40 bytes
DWORD bmp_width;
DWORD bmp_height;
WORD plane;
WORD bpp;
DWORD compression; // 0
DWORD raw_data_size;
DWORD ppm_x;
DWORD ppm_y;
DWORD  biClrUsed;         // colors used
DWORD  biClrImportant;    // important colors

 // Palette Data 8 Bytes
DWORD palette_data_1; // 0x000000
DWORD palette_data_2; // 0xFFFFFF

} BITMAPHEADER;

#pragma pack(pop)