-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBitmapWriter.h
More file actions
64 lines (59 loc) · 935 Bytes
/
BitmapWriter.h
File metadata and controls
64 lines (59 loc) · 935 Bytes
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
57
58
59
60
61
62
63
64
#pragma once
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <cstdint>
#include <string>
using namespace std;
#ifdef _MSC_VER
#pragma pack(push, 1)
#endif
struct BITMAPFILEHEADER
{
char bfType[2];
uint32_t bfSize;
uint16_t bfReserved1,
bfReserved2;
uint32_t bfOffBits;
}
#ifdef __GNUC__
__attribute__ ((packed))
#endif
;
struct BITMAPINFOHEADER
{
uint32_t biSize,
biWidth,
biHeight;
uint16_t biPlanes,
biBitCount;
uint32_t biCompression,
biSizeImage,
biXPelsPerMeter,
biYPelsPerMeter,
biClrUsed,
biClrImportant;
}
#ifdef __GNUC__
__attribute__ ((packed))
#endif
;
struct RGBQUAD
{
uint8_t rgbBlue;
uint8_t rgbGreen;
uint8_t rgbRed;
uint8_t rgbReserved;
}
#ifdef __GNUC__
__attribute__ ((packed))
#endif
;
#ifdef _MSC_VER
#pragma pack(pop)
#endif
class BitmapWriter
{
public:
static void WriteImage(string path, unsigned char image[], int width, int height);
};