-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPixel.cpp
More file actions
69 lines (57 loc) · 894 Bytes
/
Pixel.cpp
File metadata and controls
69 lines (57 loc) · 894 Bytes
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
#include "Pixel.h"
using namespace std;
Pixel::Pixel()
{
_x = 0;
_y = 0;
Colour *temp =new Colour();
_my_colour = *temp;
}
Pixel::Pixel(const Pixel& p)
{
_x = p._x;
_y = p._y;
_my_colour = p._my_colour;
}
Pixel::Pixel(int x,int y,Colour c)//construct with given values
{
_x = x;
_y = y;
_my_colour = c;
}
Pixel::~Pixel()
{
//left blank
}
Colour Pixel::getColour() const
{
return _my_colour;
}
void Pixel::setColour(Colour c)
{
_my_colour = c;
}
int Pixel::getX() const
{
return _x;
}
int Pixel::getY() const
{
return _y;
}
Pixel const& Pixel::operator=(Pixel const &p)
{
_x = p._x;
_y = p._y;
_my_colour = p._my_colour;
return (*this);
}
bool Pixel::operator==(Pixel const& p)
{
return _my_colour == p._my_colour;
}
ostream& operator<<(ostream &os, Pixel &p)
{
os << p._my_colour;
return os;
}