23 #include <tulip/Vector.h>
28 class TLP_SCOPE Color :
public tlp::Vector<unsigned char,4> {
31 inline Color(
const tlp::Vector<unsigned char,4>&);
33 inline Color(
const unsigned char red=0 ,
const unsigned char green=0 ,
const unsigned char blue=0,
const unsigned char alpha=255);
35 inline void set(
const unsigned char red=0,
const unsigned char green=0 ,
const unsigned char blue=0,
const unsigned char alpha=255);
37 inline float getRGL()
const;
39 inline float getGGL()
const;
41 inline float getBGL()
const;
43 inline float getAGL()
const;
45 inline float* getGL()
const;
47 inline unsigned char getR()
const;
49 inline unsigned char getG()
const;
51 inline unsigned char getB()
const;
53 inline unsigned char getA()
const;
55 inline void setR(
const unsigned char red);
57 inline void setG(
const unsigned char green);
59 inline void setB(
const unsigned char blue);
61 inline void setA(
const unsigned char alpha);
77 static const Color Amaranth;
78 static const Color Amber;
79 static const Color Apricot;
80 static const Color Aquamarine;
81 static const Color Azure;
82 static const Color BabyBlue;
83 static const Color Beige;
84 static const Color Black;
85 static const Color Blue;
86 static const Color BlueGreen;
87 static const Color BlueViolet;
88 static const Color Blush;
89 static const Color Bronze;
90 static const Color Brown;
91 static const Color Burgundy;
92 static const Color Byzantium;
93 static const Color Carmine;
94 static const Color Cerise;
95 static const Color Cerulean;
96 static const Color Champagne;
97 static const Color ChartreuseGreen;
98 static const Color Chocolate;
99 static const Color Coffee;
100 static const Color Copper;
101 static const Color Coral;
102 static const Color Crimson;
103 static const Color Cyan;
104 static const Color DesertSand;
105 static const Color ElectricBlue;
106 static const Color Erin;
107 static const Color Gold;
108 static const Color Gray;
109 static const Color Green;
110 static const Color Harlequin;
111 static const Color Indigo;
112 static const Color Ivory;
113 static const Color Jade;
114 static const Color JungleGreen;
115 static const Color Lavender;
116 static const Color Lemon;
117 static const Color Lilac;
118 static const Color Lime;
119 static const Color Magenta;
120 static const Color MagentaRose;
121 static const Color Maroon;
122 static const Color Mauve;
123 static const Color NavyBlue;
124 static const Color Olive;
125 static const Color Orange;
126 static const Color OrangeRed;
127 static const Color Orchid;
128 static const Color Peach;
129 static const Color Pear;
130 static const Color Periwinkle;
131 static const Color PersianBlue;
132 static const Color Pink;
133 static const Color Plum;
134 static const Color PrussianBlue;
135 static const Color Puce;
136 static const Color Purple;
137 static const Color Raspberry;
138 static const Color Red;
139 static const Color RedViolet;
140 static const Color Rose;
141 static const Color Salmon;
142 static const Color Sapphire;
143 static const Color Scarlet;
144 static const Color Silver;
145 static const Color SlateGray;
146 static const Color SpringBud;
147 static const Color SpringGreen;
148 static const Color Tan;
149 static const Color Taupe;
150 static const Color Teal;
151 static const Color Turquoise;
152 static const Color Violet;
153 static const Color Viridian;
154 static const Color White;
155 static const Color Yellow;
159 TLP_SCOPE std::ostream&
operator<<(std::ostream &os,
const tlp::Color &);
160 TLP_SCOPE std::istream&
operator>>(std::istream &is, tlp::Color &);
164 tlp::Color::Color(
const tlp::Vector<unsigned char,4> &v) : tlp::Vector<unsigned char,4>(v) {}
166 tlp::Color::Color(
const unsigned char red ,
const unsigned char green ,
const unsigned char blue,
const unsigned char alpha) {
172 void tlp::Color::set(
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha) {
179 unsigned char tlp::Color::getR()
const {
182 unsigned char tlp::Color::getG()
const {
185 unsigned char tlp::Color::getB()
const {
188 unsigned char tlp::Color::getA()
const {
192 float tlp::Color::getRGL()
const {
193 return (
float)array[0]/255.0;
195 float tlp::Color::getGGL()
const {
196 return (
float)array[1]/255.0;
198 float tlp::Color::getBGL()
const {
199 return (
float)array[2]/255.0;
201 float tlp::Color::getAGL()
const {
202 return (
float)array[3]/255.0;
204 float* tlp::Color::getGL()
const {
205 float *result=
new float[4];
213 void tlp::Color::setR(
unsigned char red) {
216 void tlp::Color::setG(
unsigned char green) {
219 void tlp::Color::setB(
unsigned char blue) {
222 void tlp::Color::setA(
unsigned char alpha) {
226 TLP_BEGIN_HASH_NAMESPACE {
228 struct hash<tlp::Color> {
229 inline std::size_t operator()(
const tlp::Color &c)
const {
230 return hash_vector(c);
233 } TLP_END_HASH_NAMESPACE