-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEasyBMP_BMP.h
More file actions
97 lines (78 loc) · 2.94 KB
/
EasyBMP_BMP.h
File metadata and controls
97 lines (78 loc) · 2.94 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*************************************************
* *
* EasyBMP Cross-Platform Windows Bitmap Library *
* *
* Author: Paul Macklin *
* email: macklin01@users.sourceforge.net *
* support: http://easybmp.sourceforge.net *
* *
* file: EasyBMP_VariousBMPutilities.h *
* date added: 05-02-2005 *
* date modified: 12-01-2006 *
* version: 1.06 *
* *
* License: BSD (revised/modified) *
* Copyright: 2005-6 by the EasyBMP Project *
* *
* description: Defines BMP class *
* *
*************************************************/
#ifndef _EasyBMP_BMP_h_
#define _EasyBMP_BMP_h_
bool EasyBMPcheckDataSize(void);
class BMP {
private:
int BitDepth;
int Width;
int Height;
RGBApixel** Pixels;
RGBApixel* Colors;
int XPelsPerMeter;
int YPelsPerMeter;
ebmpBYTE* MetaData1;
int SizeOfMetaData1;
ebmpBYTE* MetaData2;
int SizeOfMetaData2;
bool Read32bitRow(ebmpBYTE* Buffer, int BufferSize, int Row);
bool Read24bitRow(ebmpBYTE* Buffer, int BufferSize, int Row);
bool Read8bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
bool Read4bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
bool Read1bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
bool Write32bitRow(ebmpBYTE* Buffer, int BufferSize, int Row);
bool Write24bitRow(ebmpBYTE* Buffer, int BufferSize, int Row);
bool Write8bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
bool Write4bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
bool Write1bitRow( ebmpBYTE* Buffer, int BufferSize, int Row);
ebmpBYTE FindClosestColor(RGBApixel& input);
bool VerticalFlip{false};
bool HorizontalFlip{false};
public:
int TellBitDepth(void);
int TellWidth(void);
int TellHeight(void);
int AbsWidth(void);
int AbsHeight(void);
int TellNumberOfColors(void);
void SetDPI(int HorizontalDPI, int VerticalDPI);
int TellVerticalDPI(void);
int TellHorizontalDPI(void);
BMP();
BMP(BMP& Input);
~BMP();
RGBApixel& operator()(int i,int j);
RGBApixel GetPixel(int i, int j) const;
bool SetPixel(int i, int j, RGBApixel NewPixel);
bool CreateStandardColorTable(void);
bool SetSize(int NewWidth, int NewHeight);
bool SetBitDepth(int NewDepth);
bool ReadFromStream(std::istream& instream);
bool ReadFromFile(const std::string& FileName);
bool ReadFromBuffer(const unsigned char* buffer, size_t size);
bool WriteToFile(const std::string& FileName);
bool WriteToBuffer(unsigned char* buffer, size_t size);
RGBApixel GetColor(int ColorNumber);
bool SetColor(int ColorNumber, RGBApixel NewColor);
static bool exceptions(void);
static void exceptions(bool flag);
};
#endif