0
|
1 |
#ifndef BITMAP
|
|
2 |
#define BITMAP 1
|
|
3 |
|
|
4 |
class Bitmap
|
|
5 |
{
|
|
6 |
private:
|
|
7 |
char* bits;
|
|
8 |
int height;
|
|
9 |
int width;
|
|
10 |
public:
|
|
11 |
Bitmap(char* b, int h, int w);
|
|
12 |
Bitmap(char* filename);
|
|
13 |
void WriteToFile(char* filename);
|
|
14 |
inline int Height()
|
|
15 |
{
|
|
16 |
return height;
|
|
17 |
}
|
|
18 |
inline int Width()
|
|
19 |
{
|
|
20 |
return width;
|
|
21 |
}
|
|
22 |
inline int PixelAt(int x, int y)
|
|
23 |
{
|
|
24 |
int offset = (y * (width / 8)) + (x / 8);
|
|
25 |
char mask = (char) (1 << (x % 8));
|
|
26 |
return (bits[offset] & mask);
|
|
27 |
}
|
|
28 |
|
|
29 |
};
|
|
30 |
|
|
31 |
#endif
|
|
32 |
|
|
33 |
|
|
34 |
|