-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graphics.h
69 lines (58 loc) · 1.37 KB
/
Graphics.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
61
62
63
64
65
66
67
68
69
/**
* Graphics.h
* Project UID 8b3bcc444eb500121e420f7e2e359014
*
* EECS 183, Fall 2019
* Project 4
*
* Represents a 100 x 100 image.
*/
#ifndef GRAPHICS_H
#define GRAPHICS_H
#include <string>
using namespace std;
#include "Color.h"
#include "utility.h"
class Graphics
{
public:
/**
* Requires: Nothing.
* Modifies: pixelData.
* Effects: Default constructor. Sets all pixels to black.
*/
Graphics();
/**
* Requires: Nothing.
* Modifies: pixelData.
* Effects: Sets all pixels to black.
* Note: you will want to implement the private
* member function initArray before implementing
* clear()
*/
void clear();
/**
* Requires: Nothing.
* Modifies: Nothing.
* Effects: Writes the BMP file to filename.
*/
void writeFile(string fileName) const;
/**
* Requires: color is a valid Color
* Modifies: pixelData.
* Effects: Sets the pixel at (x, y) to color
* if it is within the bounds.
* See the specification for how pixels are stored.
*/
void setPixel(int x, int y, Color color);
private:
/**
* Requires: Nothing.
* Modifies: pixelData.
* Effects: Initializes all pixels in pixelData to black.
*/
void initArray();
// Holds the color in the pixels
Color pixelData[DIMENSION][DIMENSION];
};
#endif