-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPixel.h
66 lines (41 loc) · 1.36 KB
/
Pixel.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
#ifndef PIXEL_H
#define PIXEL_H
#include "vector"
#include <iostream>
#include "List"
using namespace std;
struct Vector2{ //represents the coordinated of the pixel
int x;
int y;
void initialize();
bool operator==(const Vector2& rhs);
bool operator!=(const Vector2& rhs);
};
class Pixel{
private:
bool on = false;
Vector2 position;
bool painted = false; //stores the state of whether we've painted the pixel or not
public:
bool isSquare; //true if pixel is the center of a square
int sqRadius = 0; //the radius of the square it covers, default = 0
bool scanned = false; //this is simply to check if the algorithm has already scanned the pixel
Pixel(bool _on = false);
Pixel(int r, int c, bool _on = false);
Pixel* neighbors;
void turnOn(bool _on);
//If this pixel is the center of a square, this finds its neigbours
void setNeighbours(Pixel** pixelGrid, int _R, int _C, list<Pixel> & sqPixels);
void setIncompleteSquareNeighbours(Pixel** pixelGrid, int _R, int _C, list<Pixel> & sqPixels,vector<Pixel> & toBeErased);
bool isOn();
Vector2 getPosition();
bool isPainted();
void setPainted(bool _paint);
void setOn(bool _on);
void clearNeighbors();
//Methods for sorting according to the radius of squarePixels
bool operator==(const Pixel & rhs);
bool operator>(const Pixel & rhs);
bool operator<(const Pixel & rhs);
};
#endif