color.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Mark Page
29 */
30
31
32 #pragma once
33
34 #include "../../Core/Math/vec4.h"
35 #include <vector>
36
37 namespace clan
38 {
41
42 class PixelFormat;
43 class Colorf;
44
46 class Color : public Vec4ub
47 {
50
51 public:
54 Color() {}
55
56 explicit Color(const Colorf&);
57
67 Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
68 : Vec4ub(red, green, blue, alpha) { return; }
69
76 Color(const std::string &hexstr);
77
81
82 public:
84 unsigned char get_alpha() const { return a; }
85
87 unsigned char get_red() const { return r; }
88
90 unsigned char get_green() const { return g; }
91
93 unsigned char get_blue() const { return b; }
94
96 float get_alpha_f() const { return float(a) / 255.0f; }
97
99 float get_red_f() const { return float(r) / 255.0f; }
100
102 float get_green_f() const { return float(g) / 255.0f; }
103
105 float get_blue_f() const { return float(b) / 255.0f; }
106
108 unsigned int get_argb8() const { return (((unsigned int)a) << 24) | (((unsigned int)r) << 16) | (((unsigned int)g) << 8) | (unsigned int)b; }
109
111 unsigned int get_abgr8() const { return (((unsigned int)a) << 24) | (((unsigned int)b) << 16) | (((unsigned int)g) << 8) | (unsigned int)r; }
112
114 unsigned int get_rgba8() const { return (((unsigned int)r) << 24) | (((unsigned int)g) << 16) | (((unsigned int)b) << 8) | (unsigned int)a; }
115
117 unsigned int get_bgra8() const { return (((unsigned int)b) << 24) | (((unsigned int)g) << 16) | (((unsigned int)r) << 8) | (unsigned int)a; }
118
119 // Operations:
120 public:
122 bool operator==(const Color &c) const
123 {
124 return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
125 }
126
128 bool operator!=(const Color &c) const
129 {
130 return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
131 }
132
136
137 public:
139 static Color aliceblue;
140
142 static Color antiquewhite;
143
145 static Color aqua;
146
148 static Color aquamarine;
149
151 static Color azure;
152
154 static Color beige;
155
157 static Color bisque;
158
160 static Color black;
161
163 static Color blanchedalmond;
164
166 static Color blue;
167
169 static Color blueviolet;
170
172 static Color brown;
173
175 static Color burlywood;
176
178 static Color cadetblue;
179
181 static Color chartreuse;
182
184 static Color chocolate;
185
187 static Color coral;
188
190 static Color cornflowerblue;
191
193 static Color cornsilk;
194
196 static Color crimson;
197
199 static Color cyan;
200
202 static Color darkblue;
203
205 static Color darkcyan;
206
208 static Color darkgoldenrod;
209
211 static Color darkgray;
212
214 static Color darkgreen;
215
217 static Color darkgrey;
218
220 static Color darkkhaki;
221
223 static Color darkmagenta;
224
226 static Color darkolivegreen;
227
229 static Color darkorange;
230
232 static Color darkorchid;
233
235 static Color darkred;
236
238 static Color darksalmon;
239
241 static Color darkseagreen;
242
244 static Color darkslateblue;
245
247 static Color darkslategray;
248
250 static Color darkslategrey;
251
253 static Color darkturquoise;
254
256 static Color darkviolet;
257
259 static Color deeppink;
260
262 static Color deepskyblue;
263
265 static Color dimgray;
266
268 static Color dimgrey;
269
271 static Color dodgerblue;
272
274 static Color firebrick;
275
277 static Color floralwhite;
278
280 static Color forestgreen;
281
283 static Color fuchsia;
284
286 static Color gainsboro;
287
289 static Color ghostwhite;
290
292 static Color gold;
293
295 static Color goldenrod;
296
298 static Color gray;
299
301 static Color grey;
302
304 static Color green;
305
307 static Color greenyellow;
308
310 static Color honeydew;
311
313 static Color hotpink;
314
316 static Color indianred;
317
319 static Color indigo;
320
322 static Color ivory;
323
325 static Color khaki;
326
328 static Color lavender;
329
331 static Color lavenderblush;
332
334 static Color lawngreen;
335
337 static Color lemonchiffon;
338
340 static Color lightblue;
341
343 static Color lightcoral;
344
346 static Color lightcyan;
347
349 static Color lightgoldenrodyellow;
350
352 static Color lightgray;
353
355 static Color lightgreen;
356
358 static Color lightgrey;
359
361 static Color lightpink;
362
364 static Color lightsalmon;
365
367 static Color lightseagreen;
368
370 static Color lightskyblue;
371
373 static Color lightslategray;
374
376 static Color lightslategrey;
377
379 static Color lightsteelblue;
380
382 static Color lightyellow;
383
385 static Color lime;
386
388 static Color limegreen;
389
391 static Color linen;
392
394 static Color magenta;
395
397 static Color maroon;
398
400 static Color mediumaquamarine;
401
403 static Color mediumblue;
404
406 static Color mediumorchid;
407
409 static Color mediumpurple;
410
412 static Color mediumseagreen;
413
415 static Color mediumslateblue;
416
418 static Color mediumspringgreen;
419
421 static Color mediumturquoise;
422
424 static Color mediumvioletred;
425
427 static Color midnightblue;
428
430 static Color mintcream;
431
433 static Color mistyrose;
434
436 static Color moccasin;
437
439 static Color navajowhite;
440
442 static Color navy;
443
445 static Color oldlace;
446
448 static Color olive;
449
451 static Color olivedrab;
452
454 static Color orange;
455
457 static Color orangered;
458
460 static Color orchid;
461
463 static Color palegoldenrod;
464
466 static Color palegreen;
467
469 static Color paleturquoise;
470
472 static Color palevioletred;
473
475 static Color papayawhip;
476
478 static Color peachpuff;
479
481 static Color peru;
482
484 static Color pink;
485
487 static Color plum;
488
490 static Color powderblue;
491
493 static Color purple;
494
496 static Color red;
497
499 static Color rosybrown;
500
502 static Color royalblue;
503
505 static Color saddlebrown;
506
508 static Color salmon;
509
511 static Color sandybrown;
512
514 static Color seagreen;
515
517 static Color seashell;
518
520 static Color sienna;
521
523 static Color silver;
524
526 static Color skyblue;
527
529 static Color slateblue;
530
532 static Color slategray;
533
535 static Color slategrey;
536
538 static Color snow;
539
541 static Color springgreen;
542
544 static Color steelblue;
545
547 static Color tan;
548
550 static Color teal;
551
553 static Color thistle;
554
556 static Color tomato;
557
559 static Color turquoise;
560
562 static Color violet;
563
565 static Color wheat;
566
568 static Color white;
569
571 static Color whitesmoke;
572
574 static Color yellow;
575
577 static Color yellowgreen;
578
580 static Color transparent;
581
582 static Color gray10;
583 static Color gray20;
584 static Color gray30;
585 static Color gray40;
586 static Color gray50;
587 static Color gray60;
588 static Color gray70;
589 static Color gray80;
590 static Color gray90;
591
597 static Color find_color(const std::string &name);
598
600 static std::vector<std::string> &get_names();
601
605
606 public:
608 void set_alpha(unsigned char value) { a = value; }
609
611 void set_red(unsigned char value) { r = value; }
612
614 void set_green(unsigned char value) { g = value; }
615
617 void set_blue(unsigned char value) { b = value; }
618
620 void set_alpha_f(float value) { a = (unsigned char) (value*255.0f); }
621
623 void set_red_f(float value) { r = (unsigned char) (value*255.0f); }
624
626 void set_green_f(float value) { g = (unsigned char) (value*255.0f); }
627
629 void set_blue_f(float value) { b = (unsigned char) (value*255.0f); }
630
632 void set_color(unsigned char new_red, unsigned char new_green, unsigned char new_blue, unsigned char new_alpha = 255)
633 { r = new_red; g = new_green; b = new_blue; a = new_alpha; }
634
636 void set_rgba8(unsigned int color);
637
639 void set_bgra8(unsigned int color);
640
642 void set_rgb8(unsigned int color);
643
645 void set_argb8(unsigned int color);
646
648 void set_colorf(float new_red, float new_green, float new_blue, float new_alpha = 1.0f)
649 {
650 r = (unsigned char) (new_red * 255.0f);
651 g = (unsigned char) (new_green * 255.0f);
652 b = (unsigned char) (new_blue * 255.0f);
653 a = (unsigned char) (new_alpha * 255.0f);
654 }
655
657 };
658
660 class Colorf : public Vec4f
661 {
664
665 public:
667 Colorf() : Vec4f(0.0f, 0.0f, 0.0f, 0.0f)
668 {
669 }
670
680 Colorf(float r, float g, float b, float a = 1.0f) : Vec4f(r,g,b,a)
681 {
682 }
683
690 Colorf(const float *array_rgba)
691 : Vec4f((array_rgba[0]), (array_rgba[1]), (array_rgba[2]), (array_rgba[3]))
692 {
693 }
694
698 Colorf(const Vec4f &color) : Vec4f(color)
699 {
700 }
701
711 Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
712 : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
713 {
714 }
715
725 Colorf(int r, int g, int b, int a=255)
726 : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
727 {
728 }
729
730 explicit Colorf(const Color& color)
731 : Vec4f((color.get_red()/255.0f), (color.get_green()/255.0f), (color.get_blue()/255.0f), (color.get_alpha()/255.0f))
732 {
733 }
734
741 Colorf(const std::string &hexstr)
742 {
743 *this = (Colorf)Color::find_color(hexstr);
744 }
745
749
750 public:
751
755 float get_red() const { return r; }
756
760 float get_green() const { return g; }
761
765 float get_blue() const { return b; }
766
770 float get_alpha() const { return a; }
771
775
776 public:
778 void normalize()
779 {
780 r = (r < 0.0f) ? 0.0f : ((r > 1.0f) ? 1.0f : r);
781 g = (g < 0.0f) ? 0.0f : ((g > 1.0f) ? 1.0f : g);
782 b = (b < 0.0f) ? 0.0f : ((b > 1.0f) ? 1.0f : b);
783 a = (a < 0.0f) ? 0.0f : ((a > 1.0f) ? 1.0f : a);
784 }
785
787 void set_alpha(float value) { a = value; }
788
790 void set_red(float value) { r = value; }
791
793 void set_green(float value) { g= value; }
794
796 void set_blue(float value) { b = value; }
797
799 bool operator==(const Colorf &c) const
800 {
801 return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
802 }
803
805 bool operator!=(const Colorf &c) const
806 {
807 return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
808 }
809
811 operator Color() const
812 {
813 return Color(*this);
814 }
815
819
820 public:
822 static Colorf aliceblue;
823
825 static Colorf antiquewhite;
826
828 static Colorf aqua;
829
831 static Colorf aquamarine;
832
834 static Colorf azure;
835
837 static Colorf beige;
838
840 static Colorf bisque;
841
843 static Colorf black;
844
846 static Colorf blanchedalmond;
847
849 static Colorf blue;
850
852 static Colorf blueviolet;
853
855 static Colorf brown;
856
858 static Colorf burlywood;
859
861 static Colorf cadetblue;
862
864 static Colorf chartreuse;
865
867 static Colorf chocolate;
868
870 static Colorf coral;
871
873 static Colorf cornflowerblue;
874
876 static Colorf cornsilk;
877
879 static Colorf crimson;
880
882 static Colorf cyan;
883
885 static Colorf darkblue;
886
888 static Colorf darkcyan;
889
891 static Colorf darkgoldenrod;
892
894 static Colorf darkgray;
895
897 static Colorf darkgreen;
898
900 static Colorf darkgrey;
901
903 static Colorf darkkhaki;
904
906 static Colorf darkmagenta;
907
909 static Colorf darkolivegreen;
910
912 static Colorf darkorange;
913
915 static Colorf darkorchid;
916
918 static Colorf darkred;
919
921 static Colorf darksalmon;
922
924 static Colorf darkseagreen;
925
927 static Colorf darkslateblue;
928
930 static Colorf darkslategray;
931
933 static Colorf darkslategrey;
934
936 static Colorf darkturquoise;
937
939 static Colorf darkviolet;
940
942 static Colorf deeppink;
943
945 static Colorf deepskyblue;
946
948 static Colorf dimgray;
949
951 static Colorf dimgrey;
952
954 static Colorf dodgerblue;
955
957 static Colorf firebrick;
958
960 static Colorf floralwhite;
961
963 static Colorf forestgreen;
964
966 static Colorf fuchsia;
967
969 static Colorf gainsboro;
970
972 static Colorf ghostwhite;
973
975 static Colorf gold;
976
978 static Colorf goldenrod;
979
981 static Colorf gray;
982
984 static Colorf grey;
985
987 static Colorf green;
988
990 static Colorf greenyellow;
991
993 static Colorf honeydew;
994
996 static Colorf hotpink;
997
999 static Colorf indianred;
1000
1002 static Colorf indigo;
1003
1005 static Colorf ivory;
1006
1008 static Colorf khaki;
1009
1011 static Colorf lavender;
1012
1014 static Colorf lavenderblush;
1015
1017 static Colorf lawngreen;
1018
1020 static Colorf lemonchiffon;
1021
1023 static Colorf lightblue;
1024
1026 static Colorf lightcoral;
1027
1029 static Colorf lightcyan;
1030
1032 static Colorf lightgoldenrodyellow;
1033
1035 static Colorf lightgray;
1036
1038 static Colorf lightgreen;
1039
1041 static Colorf lightgrey;
1042
1044 static Colorf lightpink;
1045
1047 static Colorf lightsalmon;
1048
1050 static Colorf lightseagreen;
1051
1053 static Colorf lightskyblue;
1054
1056 static Colorf lightslategray;
1057
1059 static Colorf lightslategrey;
1060
1062 static Colorf lightsteelblue;
1063
1065 static Colorf lightyellow;
1066
1068 static Colorf lime;
1069
1071 static Colorf limegreen;
1072
1074 static Colorf linen;
1075
1077 static Colorf magenta;
1078
1080 static Colorf maroon;
1081
1083 static Colorf mediumaquamarine;
1084
1086 static Colorf mediumblue;
1087
1089 static Colorf mediumorchid;
1090
1092 static Colorf mediumpurple;
1093
1095 static Colorf mediumseagreen;
1096
1098 static Colorf mediumslateblue;
1099
1101 static Colorf mediumspringgreen;
1102
1104 static Colorf mediumturquoise;
1105
1107 static Colorf mediumvioletred;
1108
1110 static Colorf midnightblue;
1111
1113 static Colorf mintcream;
1114
1116 static Colorf mistyrose;
1117
1119 static Colorf moccasin;
1120
1122 static Colorf navajowhite;
1123
1125 static Colorf navy;
1126
1128 static Colorf oldlace;
1129
1131 static Colorf olive;
1132
1134 static Colorf olivedrab;
1135
1137 static Colorf orange;
1138
1140 static Colorf orangered;
1141
1143 static Colorf orchid;
1144
1146 static Colorf palegoldenrod;
1147
1149 static Colorf palegreen;
1150
1152 static Colorf paleturquoise;
1153
1155 static Colorf palevioletred;
1156
1158 static Colorf papayawhip;
1159
1161 static Colorf peachpuff;
1162
1164 static Colorf peru;
1165
1167 static Colorf pink;
1168
1170 static Colorf plum;
1171
1173 static Colorf powderblue;
1174
1176 static Colorf purple;
1177
1179 static Colorf red;
1180
1182 static Colorf rosybrown;
1183
1185 static Colorf royalblue;
1186
1188 static Colorf saddlebrown;
1189
1191 static Colorf salmon;
1192
1194 static Colorf sandybrown;
1195
1197 static Colorf seagreen;
1198
1200 static Colorf seashell;
1201
1203 static Colorf sienna;
1204
1206 static Colorf silver;
1207
1209 static Colorf skyblue;
1210
1212 static Colorf slateblue;
1213
1215 static Colorf slategray;
1216
1218 static Colorf slategrey;
1219
1221 static Colorf snow;
1222
1224 static Colorf springgreen;
1225
1227 static Colorf steelblue;
1228
1230 static Colorf tan;
1231
1233 static Colorf teal;
1234
1236 static Colorf thistle;
1237
1239 static Colorf tomato;
1240
1242 static Colorf turquoise;
1243
1245 static Colorf violet;
1246
1248 static Colorf wheat;
1249
1251 static Colorf white;
1252
1254 static Colorf whitesmoke;
1255
1257 static Colorf yellow;
1258
1260 static Colorf yellowgreen;
1261
1263 static Colorf transparent;
1264
1265 static Colorf gray10;
1266 static Colorf gray20;
1267 static Colorf gray30;
1268 static Colorf gray40;
1269 static Colorf gray50;
1270 static Colorf gray60;
1271 static Colorf gray70;
1272 static Colorf gray80;
1273 static Colorf gray90;
1275 };
1276
1277 }
1278
clan::Color::set_argb8
void set_argb8(unsigned int color)
Set color based on argb color components.
clan::Color::black
static Color black
Definition: color.h:160
clan::Color::gray30
static Color gray30
Definition: color.h:584
clan::Colorf::beige
static Colorf beige
Definition: color.h:837
clan::Colorf::green
static Colorf green
Definition: color.h:987
clan::Color::linen
static Color linen
Definition: color.h:391
clan::Colorf::skyblue
static Colorf skyblue
Definition: color.h:1209
clan
Definition: clanapp.h:35
clan::Colorf::snow
static Colorf snow
Definition: color.h:1221
clan::Colorf::honeydew
static Colorf honeydew
Definition: color.h:993
clan::Colorf::deepskyblue
static Colorf deepskyblue
Definition: color.h:945
clan::Color::operator!=
bool operator!=(const Color &c) const
Color != Color operator (deep compare)
Definition: color.h:128
clan::Colorf::ghostwhite
static Colorf ghostwhite
Definition: color.h:972
clan::Colorf::mediumaquamarine
static Colorf mediumaquamarine
Definition: color.h:1083
clan::Color::lightpink
static Color lightpink
Definition: color.h:361
clan::Colorf
Floating point color description class (for float).
Definition: color.h:660
clan::Colorf::aliceblue
static Colorf aliceblue
Definition: color.h:822
clan::Color::darkgoldenrod
static Color darkgoldenrod
Definition: color.h:208
clan::Color::ghostwhite
static Color ghostwhite
Definition: color.h:289
clan::Color::set_rgb8
void set_rgb8(unsigned int color)
Set color based on rgb color components. Alpha is set to 255.
clan::Color::seashell
static Color seashell
Definition: color.h:517
clan::Colorf::papayawhip
static Colorf papayawhip
Definition: color.h:1158
clan::Color::lime
static Color lime
Definition: color.h:385
clan::Color::indianred
static Color indianred
Definition: color.h:316
clan::Colorf::mintcream
static Colorf mintcream
Definition: color.h:1113
clan::Colorf::purple
static Colorf purple
Definition: color.h:1176
clan::Color::fuchsia
static Color fuchsia
Definition: color.h:283
clan::Color::darksalmon
static Color darksalmon
Definition: color.h:238
clan::Colorf::gray80
static Colorf gray80
Definition: color.h:1272
clan::Colorf::white
static Colorf white
Definition: color.h:1251
clan::Color::get_abgr8
unsigned int get_abgr8() const
Returns the color in ABGR8888 format.
Definition: color.h:111
clan::Color::midnightblue
static Color midnightblue
Definition: color.h:427
clan::Colorf::Colorf
Colorf(const std::string &hexstr)
Constructs a color.
Definition: color.h:741
clan::Colorf::lightgrey
static Colorf lightgrey
Definition: color.h:1041
clan::Color::olive
static Color olive
Definition: color.h:448
clan::Colorf::operator==
bool operator==(const Colorf &c) const
Color == Color operator (deep compare)
Definition: color.h:799
clan::Colorf::indianred
static Colorf indianred
Definition: color.h:999
clan::Colorf::yellow
static Colorf yellow
Definition: color.h:1257
clan::Color::blanchedalmond
static Color blanchedalmond
Definition: color.h:163
clan::Colorf::mistyrose
static Colorf mistyrose
Definition: color.h:1116
clan::Color::aliceblue
static Color aliceblue
Definition: color.h:139
clan::Color::darkslategrey
static Color darkslategrey
Definition: color.h:250
clan::Color::antiquewhite
static Color antiquewhite
Definition: color.h:142
clan::Color::lightgrey
static Color lightgrey
Definition: color.h:358
clan::Colorf::Colorf
Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Constructs a color.
Definition: color.h:711
clan::Color::set_green_f
void set_green_f(float value)
Set green color component, in the range 0-1.
Definition: color.h:626
clan::Color::gray40
static Color gray40
Definition: color.h:585
clan::Colorf::cyan
static Colorf cyan
Definition: color.h:882
clan::Color::lightgreen
static Color lightgreen
Definition: color.h:355
clan::Colorf::steelblue
static Colorf steelblue
Definition: color.h:1227
clan::Colorf::gray70
static Colorf gray70
Definition: color.h:1271
clan::Color::papayawhip
static Color papayawhip
Definition: color.h:475
clan::Color::aquamarine
static Color aquamarine
Definition: color.h:148
clan::Color::darkred
static Color darkred
Definition: color.h:235
clan::Color::purple
static Color purple
Definition: color.h:493
clan::Color::ivory
static Color ivory
Definition: color.h:322
clan::Color::set_colorf
void set_colorf(float new_red, float new_green, float new_blue, float new_alpha=1.0f)
Set color based on rgba color components in the range 0-1.
Definition: color.h:648
clan::Color::lightseagreen
static Color lightseagreen
Definition: color.h:367
clan::Color::Color
Color()
Constructs a color.
Definition: color.h:54
clan::Colorf::yellowgreen
static Colorf yellowgreen
Definition: color.h:1260
clan::Color::get_green
unsigned char get_green() const
Returns the green color component, in the range 0-255.
Definition: color.h:90
clan::Color::thistle
static Color thistle
Definition: color.h:553
clan::Color::gold
static Color gold
Definition: color.h:292
clan::Color::lightgoldenrodyellow
static Color lightgoldenrodyellow
Definition: color.h:349
clan::Color::steelblue
static Color steelblue
Definition: color.h:544
clan::Color::orangered
static Color orangered
Definition: color.h:457
clan::Colorf::whitesmoke
static Colorf whitesmoke
Definition: color.h:1254
clan::Colorf::slategrey
static Colorf slategrey
Definition: color.h:1218
clan::Color::get_blue
unsigned char get_blue() const
Returns the blue color component, in the range 0-255.
Definition: color.h:93
clan::Color::palegoldenrod
static Color palegoldenrod
Definition: color.h:463
clan::Color::saddlebrown
static Color saddlebrown
Definition: color.h:505
clan::Colorf::lavender
static Colorf lavender
Definition: color.h:1011
clan::Color::gray20
static Color gray20
Definition: color.h:583
clan::Colorf::darkkhaki
static Colorf darkkhaki
Definition: color.h:903
clan::Color::khaki
static Color khaki
Definition: color.h:325
clan::Color::lightslategray
static Color lightslategray
Definition: color.h:373
clan::Color::mediumpurple
static Color mediumpurple
Definition: color.h:409
clan::Colorf::get_blue
float get_blue() const
Get Blue.
Definition: color.h:765
clan::Colorf::set_green
void set_green(float value)
Set green color component, in the range 0-1.
Definition: color.h:793
clan::Color::deepskyblue
static Color deepskyblue
Definition: color.h:262
clan::Color::lavender
static Color lavender
Definition: color.h:328
clan::Color::navajowhite
static Color navajowhite
Definition: color.h:439
clan::Color::oldlace
static Color oldlace
Definition: color.h:445
clan::Color::lavenderblush
static Color lavenderblush
Definition: color.h:331
clan::Colorf::lightgray
static Colorf lightgray
Definition: color.h:1035
clan::Color::gray10
static Color gray10
Definition: color.h:582
clan::Color::get_alpha
unsigned char get_alpha() const
Returns the alpha color component, in the range 0-255.
Definition: color.h:84
clan::Color::chartreuse
static Color chartreuse
Definition: color.h:181
clan::Color::operator==
bool operator==(const Color &c) const
Color == Color operator (deep compare)
Definition: color.h:122
clan::Colorf::mediumspringgreen
static Colorf mediumspringgreen
Definition: color.h:1101
clan::Color::olivedrab
static Color olivedrab
Definition: color.h:451
clan::Colorf::turquoise
static Colorf turquoise
Definition: color.h:1242
clan::Color::rosybrown
static Color rosybrown
Definition: color.h:499
clan::Color::mediumvioletred
static Color mediumvioletred
Definition: color.h:424
clan::Colorf::gold
static Colorf gold
Definition: color.h:975
clan::Color::wheat
static Color wheat
Definition: color.h:565
clan::Colorf::get_alpha
float get_alpha() const
Get Alpha.
Definition: color.h:770
clan::Colorf::khaki
static Colorf khaki
Definition: color.h:1008
clan::Colorf::teal
static Colorf teal
Definition: color.h:1233
clan::Color::gray60
static Color gray60
Definition: color.h:587
clan::Color::set_color
void set_color(unsigned char new_red, unsigned char new_green, unsigned char new_blue, unsigned char new_alpha=255)
Set color based on rgba color components in the range 0-255.
Definition: color.h:632
clan::Colorf::cornsilk
static Colorf cornsilk
Definition: color.h:876
clan::Colorf::operator!=
bool operator!=(const Colorf &c) const
Color != Color operator (deep compare)
Definition: color.h:805
clan::Color::navy
static Color navy
Definition: color.h:442
clan::Colorf::azure
static Colorf azure
Definition: color.h:834
clan::Colorf::forestgreen
static Colorf forestgreen
Definition: color.h:963
clan::Color::darkorange
static Color darkorange
Definition: color.h:229
clan::Color::set_red
void set_red(unsigned char value)
Set red color component, in the range 0-255.
Definition: color.h:611
clan::Color::lightyellow
static Color lightyellow
Definition: color.h:382
clan::Colorf::lightyellow
static Colorf lightyellow
Definition: color.h:1065
clan::Color::get_red
unsigned char get_red() const
Returns the red color component, in the range 0-255.
Definition: color.h:87
clan::Color::peachpuff
static Color peachpuff
Definition: color.h:478
clan::Color::lightsalmon
static Color lightsalmon
Definition: color.h:364
clan::Colorf::sienna
static Colorf sienna
Definition: color.h:1203
clan::Color::red
static Color red
Definition: color.h:496
clan::Colorf::coral
static Colorf coral
Definition: color.h:870
clan::Colorf::darkslategrey
static Colorf darkslategrey
Definition: color.h:933
clan::Colorf::mediumorchid
static Colorf mediumorchid
Definition: color.h:1089
clan::Color::lightcoral
static Color lightcoral
Definition: color.h:343
clan::Colorf::lightsalmon
static Colorf lightsalmon
Definition: color.h:1047
clan::Color::slateblue
static Color slateblue
Definition: color.h:529
clan::Colorf::seagreen
static Colorf seagreen
Definition: color.h:1197
clan::Colorf::darkolivegreen
static Colorf darkolivegreen
Definition: color.h:909
clan::Colorf::ivory
static Colorf ivory
Definition: color.h:1005
clan::Colorf::Colorf
Colorf()
Constructs a color.
Definition: color.h:667
clan::Color::gray90
static Color gray90
Definition: color.h:590
clan::Colorf::gray60
static Colorf gray60
Definition: color.h:1270
clan::Color::mediumslateblue
static Color mediumslateblue
Definition: color.h:415
clan::Color::magenta
static Color magenta
Definition: color.h:394
clan::Colorf::gray50
static Colorf gray50
Definition: color.h:1269
clan::Colorf::paleturquoise
static Colorf paleturquoise
Definition: color.h:1152
clan::Color::royalblue
static Color royalblue
Definition: color.h:502
clan::Colorf::navy
static Colorf navy
Definition: color.h:1125
clan::Colorf::salmon
static Colorf salmon
Definition: color.h:1191
clan::Colorf::gray40
static Colorf gray40
Definition: color.h:1268
clan::Colorf::lightcyan
static Colorf lightcyan
Definition: color.h:1029
clan::Color::get_green_f
float get_green_f() const
Returns the green color component, in the range 0-1.
Definition: color.h:102
clan::Colorf::chartreuse
static Colorf chartreuse
Definition: color.h:864
clan::Colorf::dimgrey
static Colorf dimgrey
Definition: color.h:951
clan::Colorf::antiquewhite
static Colorf antiquewhite
Definition: color.h:825
clan::Color::silver
static Color silver
Definition: color.h:523
clan::Colorf::tan
static Colorf tan
Definition: color.h:1230
clan::StyleTokenType::string
@ keyword
clan::Colorf::lightskyblue
static Colorf lightskyblue
Definition: color.h:1053
clan::Colorf::orchid
static Colorf orchid
Definition: color.h:1143
clan::Colorf::mediumblue
static Colorf mediumblue
Definition: color.h:1086
clan::Color::cornsilk
static Color cornsilk
Definition: color.h:193
clan::Vec4::a
Type a
Definition: vec4.h:83
clan::Colorf::darkslateblue
static Colorf darkslateblue
Definition: color.h:927
clan::Colorf::seashell
static Colorf seashell
Definition: color.h:1200
clan::Color::violet
static Color violet
Definition: color.h:562
clan::Color::mediumseagreen
static Color mediumseagreen
Definition: color.h:412
clan::Color::darkviolet
static Color darkviolet
Definition: color.h:256
clan::Color::gray80
static Color gray80
Definition: color.h:589
clan::Colorf::lightpink
static Colorf lightpink
Definition: color.h:1044
clan::Colorf::Colorf
Colorf(const float *array_rgba)
Constructs a color.
Definition: color.h:690
clan::Color::tomato
static Color tomato
Definition: color.h:556
clan::Color::forestgreen
static Color forestgreen
Definition: color.h:280
clan::Color::yellowgreen
static Color yellowgreen
Definition: color.h:577
clan::Color::cyan
static Color cyan
Definition: color.h:199
clan::Color::set_alpha_f
void set_alpha_f(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:620
clan::Color::indigo
static Color indigo
Definition: color.h:319
clan::Color::moccasin
static Color moccasin
Definition: color.h:436
clan::Colorf::tomato
static Colorf tomato
Definition: color.h:1239
clan::Color::set_red_f
void set_red_f(float value)
Set red color component, in the range 0-1.
Definition: color.h:623
clan::Colorf::gray
static Colorf gray
Definition: color.h:981
clan::Colorf::royalblue
static Colorf royalblue
Definition: color.h:1185
clan::Colorf::darkorange
static Colorf darkorange
Definition: color.h:912
clan::Colorf::burlywood
static Colorf burlywood
Definition: color.h:858
clan::Color::set_bgra8
void set_bgra8(unsigned int color)
Set color based on rgba color components.
clan::Color::transparent
static Color transparent
rgba(0, 0, 0, 0).
Definition: color.h:580
clan::Colorf::darkgray
static Colorf darkgray
Definition: color.h:894
clan::Color::bisque
static Color bisque
Definition: color.h:157
clan::Colorf::lightseagreen
static Colorf lightseagreen
Definition: color.h:1050
clan::Color::peru
static Color peru
Definition: color.h:481
clan::Color::palegreen
static Color palegreen
Definition: color.h:466
clan::Color::cornflowerblue
static Color cornflowerblue
Definition: color.h:190
clan::Color::lightblue
static Color lightblue
Definition: color.h:340
clan::Vec4::r
Type r
Definition: vec4.h:80
clan::Color::lightgray
static Color lightgray
Definition: color.h:352
clan::Color::mintcream
static Color mintcream
Definition: color.h:430
clan::Key::f
clan::Color::lawngreen
static Color lawngreen
Definition: color.h:334
clan::Colorf::Colorf
Colorf(const Vec4f &color)
Constructs a color.
Definition: color.h:698
clan::Colorf::silver
static Colorf silver
Definition: color.h:1206
clan::Color::palevioletred
static Color palevioletred
Definition: color.h:472
clan::Colorf::darkslategray
static Colorf darkslategray
Definition: color.h:930
clan::Color::plum
static Color plum
Definition: color.h:487
clan::Color::brown
static Color brown
Definition: color.h:172
clan::Colorf::crimson
static Colorf crimson
Definition: color.h:879
clan::Color::gray
static Color gray
Definition: color.h:298
clan::Colorf::moccasin
static Colorf moccasin
Definition: color.h:1119
clan::Colorf::darkmagenta
static Colorf darkmagenta
Definition: color.h:906
clan::Colorf::palevioletred
static Colorf palevioletred
Definition: color.h:1155
clan::Colorf::lightgreen
static Colorf lightgreen
Definition: color.h:1038
clan::Colorf::powderblue
static Colorf powderblue
Definition: color.h:1173
clan::Colorf::darkviolet
static Colorf darkviolet
Definition: color.h:939
clan::Color::skyblue
static Color skyblue
Definition: color.h:526
clan::Color::get_red_f
float get_red_f() const
Returns the red color component, in the range 0-1.
Definition: color.h:99
clan::Colorf::fuchsia
static Colorf fuchsia
Definition: color.h:966
clan::Color::firebrick
static Color firebrick
Definition: color.h:274
clan::Color::mediumspringgreen
static Color mediumspringgreen
Definition: color.h:418
clan::Colorf::darkgoldenrod
static Colorf darkgoldenrod
Definition: color.h:891
clan::Color::sienna
static Color sienna
Definition: color.h:520
clan::Color::Color
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Constructs a color.
Definition: color.h:67
clan::Colorf::bisque
static Colorf bisque
Definition: color.h:840
clan::Colorf::palegreen
static Colorf palegreen
Definition: color.h:1149
clan::Color::orange
static Color orange
Definition: color.h:454
clan::Colorf::lightslategray
static Colorf lightslategray
Definition: color.h:1056
clan::Colorf::orangered
static Colorf orangered
Definition: color.h:1140
clan::Colorf::lightblue
static Colorf lightblue
Definition: color.h:1023
clan::Color::mistyrose
static Color mistyrose
Definition: color.h:433
clan::Colorf::maroon
static Colorf maroon
Definition: color.h:1080
clan::Color::seagreen
static Color seagreen
Definition: color.h:514
clan::Color::salmon
static Color salmon
Definition: color.h:508
clan::Color::get_blue_f
float get_blue_f() const
Returns the blue color component, in the range 0-1.
Definition: color.h:105
clan::Color::darkmagenta
static Color darkmagenta
Definition: color.h:223
clan::Color::set_alpha
void set_alpha(unsigned char value)
Set alpha color component, in the range 0-255.
Definition: color.h:608
clan::Colorf::get_red
float get_red() const
Get Red.
Definition: color.h:755
clan::Color::lightsteelblue
static Color lightsteelblue
Definition: color.h:379
clan::Color::darkblue
static Color darkblue
Definition: color.h:202
clan::Colorf::sandybrown
static Colorf sandybrown
Definition: color.h:1194
clan::Color::maroon
static Color maroon
Definition: color.h:397
clan::Color::coral
static Color coral
Definition: color.h:187
clan::Color::honeydew
static Color honeydew
Definition: color.h:310
clan::Colorf::gray10
static Colorf gray10
Definition: color.h:1265
clan::Colorf::mediumvioletred
static Colorf mediumvioletred
Definition: color.h:1107
clan::Color::get_bgra8
unsigned int get_bgra8() const
Returns the color in BGRA8888 format.
Definition: color.h:117
clan::Color::darkslateblue
static Color darkslateblue
Definition: color.h:244
clan::Color::teal
static Color teal
Definition: color.h:550
clan::Colorf::darksalmon
static Colorf darksalmon
Definition: color.h:921
clan::Color::green
static Color green
Definition: color.h:304
clan::Colorf::grey
static Colorf grey
Definition: color.h:984
clan::Color::lightskyblue
static Color lightskyblue
Definition: color.h:370
clan::Color::gray70
static Color gray70
Definition: color.h:588
clan::Colorf::darkgreen
static Colorf darkgreen
Definition: color.h:897
clan::Colorf::dodgerblue
static Colorf dodgerblue
Definition: color.h:954
clan::Color::paleturquoise
static Color paleturquoise
Definition: color.h:469
clan::Color::yellow
static Color yellow
Definition: color.h:574
clan::Colorf::lime
static Colorf lime
Definition: color.h:1068
clan::Colorf::plum
static Colorf plum
Definition: color.h:1170
clan::Colorf::dimgray
static Colorf dimgray
Definition: color.h:948
clan::Color::mediumaquamarine
static Color mediumaquamarine
Definition: color.h:400
clan::Colorf::aquamarine
static Colorf aquamarine
Definition: color.h:831
clan::Color::powderblue
static Color powderblue
Definition: color.h:490
clan::Colorf::linen
static Colorf linen
Definition: color.h:1074
clan::Colorf::wheat
static Colorf wheat
Definition: color.h:1248
clan::Color::tan
static Color tan
Definition: color.h:547
clan::Color::get_argb8
unsigned int get_argb8() const
Returns the color in ARGB8888 format.
Definition: color.h:108
clan::Color::set_blue_f
void set_blue_f(float value)
Set blue color component, in the range 0-1.
Definition: color.h:629
clan::Colorf::floralwhite
static Colorf floralwhite
Definition: color.h:960
clan::Color::darkturquoise
static Color darkturquoise
Definition: color.h:253
clan::Colorf::gray20
static Colorf gray20
Definition: color.h:1266
clan::Colorf::midnightblue
static Colorf midnightblue
Definition: color.h:1110
clan::Colorf::saddlebrown
static Colorf saddlebrown
Definition: color.h:1188
clan::Color::darkkhaki
static Color darkkhaki
Definition: color.h:220
clan::Colorf::violet
static Colorf violet
Definition: color.h:1245
clan::Color::blueviolet
static Color blueviolet
Definition: color.h:169
clan::Colorf::lightsteelblue
static Colorf lightsteelblue
Definition: color.h:1062
clan::Colorf::deeppink
static Colorf deeppink
Definition: color.h:942
clan::Color::aqua
static Color aqua
Definition: color.h:145
clan::Colorf::peru
static Colorf peru
Definition: color.h:1164
clan::Color::set_green
void set_green(unsigned char value)
Set green color component, in the range 0-255.
Definition: color.h:614
clan::Colorf::aqua
static Colorf aqua
Definition: color.h:828
clan::Colorf::thistle
static Colorf thistle
Definition: color.h:1236
clan::Colorf::lavenderblush
static Colorf lavenderblush
Definition: color.h:1014
clan::Colorf::magenta
static Colorf magenta
Definition: color.h:1077
clan::Colorf::gainsboro
static Colorf gainsboro
Definition: color.h:969
clan::Color::floralwhite
static Color floralwhite
Definition: color.h:277
clan::Color::darkorchid
static Color darkorchid
Definition: color.h:232
clan::Colorf::Colorf
Colorf(const Color &color)
Definition: color.h:730
clan::Color::get_rgba8
unsigned int get_rgba8() const
Returns the color in RGBA8888 format.
Definition: color.h:114
clan::Color::slategrey
static Color slategrey
Definition: color.h:535
clan::Color::dodgerblue
static Color dodgerblue
Definition: color.h:271
clan::Colorf::red
static Colorf red
Definition: color.h:1179
clan::Colorf::mediumpurple
static Colorf mediumpurple
Definition: color.h:1092
clan::Color::darkgreen
static Color darkgreen
Definition: color.h:214
clan::Colorf::lightgoldenrodyellow
static Colorf lightgoldenrodyellow
Definition: color.h:1032
clan::Color::get_alpha_f
float get_alpha_f() const
Returns the alpha color component, in the range 0-1.
Definition: color.h:96
clan::Color::greenyellow
static Color greenyellow
Definition: color.h:307
clan::Color::beige
static Color beige
Definition: color.h:154
clan::Colorf::greenyellow
static Colorf greenyellow
Definition: color.h:990
clan::Colorf::transparent
static Colorf transparent
rgba(0, 0, 0, 0).
Definition: color.h:1263
clan::Color::set_rgba8
void set_rgba8(unsigned int color)
Set color based on rgba color components.
clan::Colorf::peachpuff
static Colorf peachpuff
Definition: color.h:1161
clan::Colorf::hotpink
static Colorf hotpink
Definition: color.h:996
clan::Color::mediumturquoise
static Color mediumturquoise
Definition: color.h:421
clan::Color::blue
static Color blue
Definition: color.h:166
clan::Colorf::navajowhite
static Colorf navajowhite
Definition: color.h:1122
clan::Color::cadetblue
static Color cadetblue
Definition: color.h:178
clan::Colorf::set_alpha
void set_alpha(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:787
clan::Colorf::firebrick
static Colorf firebrick
Definition: color.h:957
clan::Colorf::darkorchid
static Colorf darkorchid
Definition: color.h:915
clan::Colorf::Colorf
Colorf(int r, int g, int b, int a=255)
Constructs a color.
Definition: color.h:725
clan::Color::white
static Color white
Definition: color.h:568
clan::Color::mediumorchid
static Color mediumorchid
Definition: color.h:406
clan::Color::lightslategrey
static Color lightslategrey
Definition: color.h:376
clan::Colorf::gray30
static Colorf gray30
Definition: color.h:1267
clan::Colorf::olivedrab
static Colorf olivedrab
Definition: color.h:1134
clan::Color::dimgrey
static Color dimgrey
Definition: color.h:268
clan::Colorf::black
static Colorf black
Definition: color.h:843
clan::Colorf::palegoldenrod
static Colorf palegoldenrod
Definition: color.h:1146
clan::Color::lightcyan
static Color lightcyan
Definition: color.h:346
clan::Vec4::b
Type b
Definition: vec4.h:82
clan::Color::darkseagreen
static Color darkseagreen
Definition: color.h:241
clan::Color::slategray
static Color slategray
Definition: color.h:532
clan::Colorf::set_blue
void set_blue(float value)
Set blue color component, in the range 0-1.
Definition: color.h:796
clan::Color::burlywood
static Color burlywood
Definition: color.h:175
clan::Colorf::mediumturquoise
static Colorf mediumturquoise
Definition: color.h:1104
clan::Color::sandybrown
static Color sandybrown
Definition: color.h:511
clan::Color::hotpink
static Color hotpink
Definition: color.h:313
clan::Key::c
clan::Color::goldenrod
static Color goldenrod
Definition: color.h:295
clan::Color::mediumblue
static Color mediumblue
Definition: color.h:403
clan::Color::darkgrey
static Color darkgrey
Definition: color.h:217
clan::Color::deeppink
static Color deeppink
Definition: color.h:259
clan::Colorf::lightslategrey
static Colorf lightslategrey
Definition: color.h:1059
clan::Colorf::mediumseagreen
static Colorf mediumseagreen
Definition: color.h:1095
clan::StyleValueType::color
value is an url
clan::Colorf::set_red
void set_red(float value)
Set red color component, in the range 0-1.
Definition: color.h:790
clan::Colorf::lawngreen
static Colorf lawngreen
Definition: color.h:1017
clan::Color::orchid
static Color orchid
Definition: color.h:460
clan::Color::darkslategray
static Color darkslategray
Definition: color.h:247
clan::Colorf::springgreen
static Colorf springgreen
Definition: color.h:1224
clan::Colorf::darkcyan
static Colorf darkcyan
Definition: color.h:888
clan::Colorf::orange
static Colorf orange
Definition: color.h:1137
clan::Vec4
4D vector
Definition: size.h:47
clan::Colorf::chocolate
static Colorf chocolate
Definition: color.h:867
clan::Color::crimson
static Color crimson
Definition: color.h:196
clan::Colorf::darkgrey
static Colorf darkgrey
Definition: color.h:900
clan::Color::darkcyan
static Color darkcyan
Definition: color.h:205
clan::Colorf::brown
static Colorf brown
Definition: color.h:855
clan::Colorf::darkred
static Colorf darkred
Definition: color.h:918
clan::Color::whitesmoke
static Color whitesmoke
Definition: color.h:571
clan::Colorf::darkblue
static Colorf darkblue
Definition: color.h:885
clan::Color::get_names
static std::vector< std::string > & get_names()
Returns the names of static colors defined.
clan::Colorf::slateblue
static Colorf slateblue
Definition: color.h:1212
clan::Colorf::mediumslateblue
static Colorf mediumslateblue
Definition: color.h:1098
clan::Colorf::darkturquoise
static Colorf darkturquoise
Definition: color.h:936
clan::Color::azure
static Color azure
Definition: color.h:151
clan::Color::gainsboro
static Color gainsboro
Definition: color.h:286
clan::Color::grey
static Color grey
Definition: color.h:301
clan::Color::limegreen
static Color limegreen
Definition: color.h:388
clan::Color::darkolivegreen
static Color darkolivegreen
Definition: color.h:226
clan::Colorf::goldenrod
static Colorf goldenrod
Definition: color.h:978
clan::Colorf::normalize
void normalize()
Normalize the color by ensuring that all color values lie inbetween (0.0, 1.0)
Definition: color.h:778
clan::Colorf::indigo
static Colorf indigo
Definition: color.h:1002
clan::Colorf::lemonchiffon
static Colorf lemonchiffon
Definition: color.h:1020
clan::Colorf::gray90
static Colorf gray90
Definition: color.h:1273
clan::Color
Color description class.
Definition: color.h:46
clan::Color::lemonchiffon
static Color lemonchiffon
Definition: color.h:337
clan::Color::gray50
static Color gray50
Definition: color.h:586
clan::Colorf::lightcoral
static Colorf lightcoral
Definition: color.h:1026
clan::Color::turquoise
static Color turquoise
Definition: color.h:559
clan::Color::chocolate
static Color chocolate
Definition: color.h:184
clan::Colorf::oldlace
static Colorf oldlace
Definition: color.h:1128
clan::Colorf::limegreen
static Colorf limegreen
Definition: color.h:1071
clan::Color::pink
static Color pink
Definition: color.h:484
clan::Colorf::cornflowerblue
static Colorf cornflowerblue
Definition: color.h:873
clan::Color::darkgray
static Color darkgray
Definition: color.h:211
clan::Colorf::darkseagreen
static Colorf darkseagreen
Definition: color.h:924
clan::Colorf::Colorf
Colorf(float r, float g, float b, float a=1.0f)
Constructs a color.
Definition: color.h:680
clan::Color::springgreen
static Color springgreen
Definition: color.h:541
clan::Vec4::g
Type g
Definition: vec4.h:81
clan::Color::snow
static Color snow
Definition: color.h:538
clan::Colorf::cadetblue
static Colorf cadetblue
Definition: color.h:861
clan::Colorf::blueviolet
static Colorf blueviolet
Definition: color.h:852
clan::Colorf::pink
static Colorf pink
Definition: color.h:1167
clan::Color::find_color
static Color find_color(const std::string &name)
Find and returns the static color matching a string.
clan::Colorf::blue
static Colorf blue
Definition: color.h:849
clan::Color::set_blue
void set_blue(unsigned char value)
Set blue color component, in the range 0-255.
Definition: color.h:617
clan::Colorf::slategray
static Colorf slategray
Definition: color.h:1215
clan::Colorf::rosybrown
static Colorf rosybrown
Definition: color.h:1182
clan::Colorf::olive
static Colorf olive
Definition: color.h:1131
clan::Colorf::blanchedalmond
static Colorf blanchedalmond
Definition: color.h:846
clan::Color::dimgray
static Color dimgray
Definition: color.h:265
clan::Colorf::get_green
float get_green() const
Get Green.
Definition: color.h:760