-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpixel.cpp
More file actions
60 lines (51 loc) · 785 Bytes
/
pixel.cpp
File metadata and controls
60 lines (51 loc) · 785 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
#include "pixel.h"
Pixel::Pixel()
{
//build a white pixel
_red = 255;
_green = 255;
_blue = 255;
}
Pixel::~Pixel()
{
//dtor
}
Pixel::Pixel(unsigned char r, unsigned char g, unsigned char b)
{
_red = r;
_green = g;
_blue = b;
}
Pixel& Pixel::operator= (const Pixel& rhs)
{
if(&rhs != this)
{
_red = rhs._red;
_green = rhs._green;
_blue = rhs._blue;
}
}
void Pixel::clear()
{
_red = 255;
_green = 255;
_blue = 255;
}
void Pixel::blacken()
{
_red = 0;
_green = 0;
_blue = 0;
}
unsigned char Pixel::red()
{
return _red;
}
unsigned char Pixel::green()
{
return _green;
}
unsigned char Pixel::blue()
{
return _blue;
}