-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathImage.h
More file actions
58 lines (47 loc) · 753 Bytes
/
Image.h
File metadata and controls
58 lines (47 loc) · 753 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
#ifndef IMAGE_H
#define IMAGE_H
#include <cstdio> // needed because of NULL
class Image
{
public:
Image( unsigned int height, unsigned int width, unsigned char depth )
{
this->height = height;
this->width = width;
this->depth = depth;
buffer = NULL;
}
~Image()
{
delete[] buffer;
buffer = NULL;
}
void createBuffer()
{
if( buffer != NULL )
delete[] buffer;
buffer = new char[ width * height * depth / 8 ];
}
void* getBuffer()
{
return buffer;
}
unsigned int getHeight() const
{
return height;
}
unsigned int getWidth() const
{
return width;
}
unsigned char getDepth()
{
return depth;
}
private:
unsigned int height;
unsigned int width;
unsigned char depth;
char *buffer;
};
#endif