-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrtcolor.h
94 lines (76 loc) · 1.85 KB
/
rtcolor.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef RTCOLOR_H
#define RTCOLOR_H
class RTColor
{
public:
/**
* @brief RTColor Color model. RGB is unsigned int
* @param r Red value
* @param g Green value
* @param b Blue value
*/
RTColor(unsigned int r, unsigned int g, unsigned int b);
/**
* @brief RTColor Does a copy of the color
* @param c Object to be copied.
*/
RTColor(const RTColor &c);
/**
* @brief RTColor Default constructor. Black color.
*/
RTColor();
/**
* @brief setR Set the value for red component
* @param r Amount of red
*/
void setR(unsigned int r);
/**
* @brief setG Set the value for green component
* @param g Amount of green
*/
void setG(unsigned int g);
/**
* @brief setB Set the value of blue component
* @param b Amount of blue
*/
void setB(unsigned int b);
/**
* @brief getR Get the amount of red
* @return Amount of red
*/
unsigned int getR() const;
/**
* @brief getG Get the amount of green
* @return Amount of green
*/
unsigned int getG() const;
/**
* @brief getB Get the amount of blue
* @return Amount of blue
*/
unsigned int getB() const;
/**
* @brief operator + Performs the sum of two colors
* @param color
*/
RTColor operator +(RTColor color);
/**
* @brief operator - Performs the subtraction of two colors
* @param color
*/
RTColor operator -(RTColor color);
/**
* @brief operator * Performs the multiplication by a scalar
* @param value
*/
RTColor operator *(double value);
RTColor operator *(RTColor c);
/**
* @brief operator / Performs the division by a scalar
* @param value
*/
RTColor operator /(double value);
private:
unsigned int _r, _g, _b;
};
#endif // RTCOLOR_H