forked from rpbpolis/spic-prj-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Color.hpp
97 lines (83 loc) · 3.17 KB
/
Color.hpp
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
95
96
97
#ifndef COLOR_H_
#define COLOR_H_
namespace spic {
/**
* @brief Color represents a red-green-blue color with alpha.
*/
class Color {
public:
/**
* @brief Constructor, accepting an rgb value and an alpha (transparency).
* @param red The red component, 0 ≤ r ≤ 1.
* @param green The green component, 0 ≤ g ≤ 1.
* @param blue The blue component, 0 ≤ b ≤ 1.
* @param alpha The transparency component, 0 ≤ alpha ≤ 1.
* @spicapi
*/
Color(double red, double green, double blue, double alpha);
/**
* @brief One of the standard colors (read-only): white.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& white() { return _white; }
/**
* @brief One of the standard colors (read-only): red.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& red() { return _red; }
/**
* @brief One of the standard colors (read-only): green.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& green() { return _green; }
/**
* @brief One of the standard colors (read-only): blue.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& blue() { return _blue; }
/**
* @brief One of the standard colors (read-only): cyan.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& cyan() { return _cyan; }
/**
* @brief One of the standard colors (read-only): magenta.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& magenta() { return _magenta; }
/**
* @brief One of the standard colors (read-only): yellow.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& yellow() { return _yellow; }
/**
* @brief One of the standard colors (read-only): black.
* @return A reference to a statically allocated Color instance.
* @spicapi
*/
static const Color& black() { return _black; }
// ... more standard colors here
private:
double r;
double g;
double b;
double a;
static Color _white;
static Color _red;
static Color _green;
static Color _blue;
static Color _cyan;
static Color _magenta;
static Color _yellow;
static Color _black;
// ... more standard color here
};
}
#endif // COLOR_H_