-
Notifications
You must be signed in to change notification settings - Fork 0
/
Image.hpp
36 lines (34 loc) · 1020 Bytes
/
Image.hpp
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
#ifndef __prog_Image_hpp__
#define __prog_Image_hpp__
#include "Color.hpp"
namespace prog
{
/*
Represents an image using a bidirectional array, where each
pixel is represented as a Color object (previously implemented).
*/
class Image
{
private:
// Image width variable.
int w;
// Image height variable.
int h;
// Pointer to a bidirectional array of colors (the image itself).
Color **img;
public:
// Constructor with arguments (an image width, height and a color to fill).
Image(int w, int h, const Color &fill = {255, 255, 255});
// Destructor.
~Image();
// Returns the image width.
int width() const;
// Returns the image height.
int height() const;
// Modifies the color at a certain pixel (coordinate).
Color &at(int x, int y);
// Returns the color at a certain pixel (coordinate).
const Color &at(int x, int y) const;
};
}
#endif