-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_class.h
More file actions
52 lines (40 loc) · 1.26 KB
/
image_class.h
File metadata and controls
52 lines (40 loc) · 1.26 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
#ifndef CLASS_INCLUDED
#define CLASS_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//============================================================================
// Class declaration
//============================================================================
class Image
{
private:
u_char* data;
int width;
int height;
public:
// Getters
int getWidth() const;
int getHeight() const;
u_char* getData() const;
// Default constructor
Image();
// Copy constructor
Image(const Image& old_one);
// Destructor
~Image();
// Write the image contained in <my_image.data> (of size <my_image.width>
// * <my_image.height>) into plain RGB ppm file at <file_name>
void ppm_write_to_file(const char* file_name);
// Read the image contained in plain RGB ppm file at <file_name>
// into <my_image.data> and set <my_image.width> and <my_image.height>
// accordingly
// Warning: data is malloc_ed, don't forget to free it
void ppm_read_from_file(const char* file_name);
// Desaturate (transform to B&W) <my_image>
void ppm_desaturate();
// Shrink image (of original size <my_image.width> * <my_image.height>)
// by factor <factor> (<my_image> updated accordingly)
void ppm_shrink(int factor);
};
#endif