-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitmap.h
64 lines (45 loc) · 1.25 KB
/
bitmap.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
57
58
59
60
61
62
63
64
#include <stdio.h>
#include <math.h>
#include <windows.h>
#ifndef BITMAP_H
#define BITMAP_H
class bitmap {
typedef struct {
unsigned short bfType;
unsigned int bfSize;
unsigned short bfReserved1;
unsigned short bfReserved2;
unsigned int bfOffBits;
} bmpFHEAD;
typedef struct bmpIHEAD {
unsigned int biSize;
int biWidth;
int biHeight;
unsigned short biPlanes;
unsigned short biBitCount;
unsigned int biCompression;
unsigned int biSizeImage;
int biXPelsPerMeter;
int biYPelsPerMeter;
unsigned int biClrUsed;
unsigned int biClrImportant;
} bmpIHEAD;
typedef struct bmpPAL {
unsigned char r;
unsigned char g;
unsigned char b;
} PAL;
int width, height;
public:
unsigned char *data;
bitmap(void);
bool create(int x, int y);
bool load(char *filename);
bool save(char *filename);
int getwidth(void) { if (data) return width; else return -1; };
int getheight(void) { if (data) return height; else return -1; };
void getcolor(int x, int y, BYTE &r, BYTE &g, BYTE &b);
void setcolor(int x, int y, BYTE r, BYTE g, BYTE b);
~bitmap(void);
};
#endif BITMAP_H