-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.h
60 lines (48 loc) · 1.34 KB
/
image.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
#ifndef IMAGE_H
#define IMAGE_H
#include <cstdint>
#include <iostream>
#include "color.h"
class Image {
private:
int m_width, m_height; // dimensions of the Image
Color *m_pixels; // an array of pixel colors
// value semantics are prohibited
Image(const Image &);
Image &operator=(const Image &);
public:
/** constructor for an Image
* @param width of the image
* @param height of the image
*/
Image(int width, int height);
/** The destructor releases allocated memory as needed to avoid leaks. */
~Image();
/** function to retrieve width of image
* @return width
*/
int get_width() const { return m_width; }
/** function to retrieve height of image
* @return height
*/
int get_height() const { return m_height; }
/** function to retrieve the array of pixels in the image
* @return pointer to an array of pixels
*/
const Color* get_pixels() const;
/** function to retrieve a pixel
* @param row
* @param col
* @return a reference to the Color object
*/
const Color& get_pixel(int row, int col) const;
/** function to retrieve a pixel
* @param row
* @param col
* @param color of the intended pixel
* @return a reference to the Color object
*/
void set_pixel(int row, int col, const Color& color);
void write_png(std::ostream &out);
};
#endif // IMAGE_H