-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbmp.h
56 lines (48 loc) · 1.07 KB
/
bmp.h
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
52
53
54
55
56
#ifndef _BITMAP_H_
#define _BITMAP_H_
#include <stdio.h>
#pragma pack(push, 1)
typedef struct tagBITMAPFILEHEADER
{
uint16_t bfType;
uint32_t bfSize;
uint16_t bfReserved1;
uint16_t bfReserved2;
uint32_t bfOffBits;
} BITMAPFILEHEADER;
typedef struct tagBITMAPINFOHEADER
{
uint32_t biSize;
int biWidth;
int biHeight;
uint16_t biPlanes;
uint16_t biBitCount;
uint32_t biCompression;
uint32_t biSizeImage;
uint32_t biXPelsPerMeter;
uint32_t biYPelsPerMeter;
uint32_t biClrUsed;
uint32_t biClrImportant;
} BITMAPINFOHEADER;
typedef struct tagRGBQUAD
{
uint8_t rgbBlue;
uint8_t rgbGreen;
uint8_t rgbRed;
uint8_t rgbReserved;
} RGBQUAD;
typedef struct tagBITMAPINFO
{
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO;
typedef struct tagBITMAP
{
BITMAPFILEHEADER bfHeader;
BITMAPINFO biInfo;
} BITMAPFILE;
uint8_t* GetBmpData(uint8_t *bitCountPerPix, int *width, int *height, const char* filename);
int GenBmpFile(uint8_t *pData, uint8_t bitCountPerPix, int width, int height, void *image_buffer);
void FreeBmpData(uint8_t *pdata);
#pragma pack(pop)
#endif