color.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 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 "../api_display.h"
35 #include "../../Core/Math/vec4.h"
36 #include <vector>
37 
38 namespace clan
39 {
42 
43 class PixelFormat;
44 class Colorf;
45 
47 class CL_API_DISPLAY Color : public Vec4ub
48 {
51 
52 public:
55  Color() {}
56 
57  explicit Color(const Colorf&);
58 
68  Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
69  : Vec4ub(red, green, blue, alpha) { return; }
70 
77  Color(const std::string &hexstr);
78 
82 
83 public:
85  unsigned char get_alpha() const { return a; }
86 
88  unsigned char get_red() const { return r; }
89 
91  unsigned char get_green() const { return g; }
92 
94  unsigned char get_blue() const { return b; }
95 
97  float get_alpha_f() const { return float(a) / 255.0f; }
98 
100  float get_red_f() const { return float(r) / 255.0f; }
101 
103  float get_green_f() const { return float(g) / 255.0f; }
104 
106  float get_blue_f() const { return float(b) / 255.0f; }
107 
109  unsigned int get_argb8() const { return (((unsigned int)a) << 24) | (((unsigned int)r) << 16) | (((unsigned int)g) << 8) | (unsigned int)b; }
110 
112  unsigned int get_abgr8() const { return (((unsigned int)a) << 24) | (((unsigned int)b) << 16) | (((unsigned int)g) << 8) | (unsigned int)r; }
113 
115  unsigned int get_rgba8() const { return (((unsigned int)r) << 24) | (((unsigned int)g) << 16) | (((unsigned int)b) << 8) | (unsigned int)a; }
116 
118  unsigned int get_bgra8() const { return (((unsigned int)b) << 24) | (((unsigned int)g) << 16) | (((unsigned int)r) << 8) | (unsigned int)a; }
119 
120 // Operations:
121 public:
123  bool operator==(const Color &c) const
124  {
125  return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
126  }
127 
129  bool operator!=(const Color &c) const
130  {
131  return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
132  }
133 
137 
138 public:
140  static Color aliceblue;
141 
144 
146  static Color aqua;
147 
150 
152  static Color azure;
153 
155  static Color beige;
156 
158  static Color bisque;
159 
161  static Color black;
162 
165 
167  static Color blue;
168 
171 
173  static Color brown;
174 
176  static Color burlywood;
177 
179  static Color cadetblue;
180 
183 
185  static Color chocolate;
186 
188  static Color coral;
189 
192 
194  static Color cornsilk;
195 
197  static Color crimson;
198 
200  static Color cyan;
201 
203  static Color darkblue;
204 
206  static Color darkcyan;
207 
210 
212  static Color darkgray;
213 
215  static Color darkgreen;
216 
218  static Color darkgrey;
219 
221  static Color darkkhaki;
222 
225 
228 
231 
234 
236  static Color darkred;
237 
240 
243 
246 
249 
252 
255 
258 
260  static Color deeppink;
261 
264 
266  static Color dimgray;
267 
269  static Color dimgrey;
270 
273 
275  static Color firebrick;
276 
279 
282 
284  static Color fuchsia;
285 
287  static Color gainsboro;
288 
291 
293  static Color gold;
294 
296  static Color goldenrod;
297 
299  static Color gray;
300 
302  static Color grey;
303 
305  static Color green;
306 
309 
311  static Color honeydew;
312 
314  static Color hotpink;
315 
317  static Color indianred;
318 
320  static Color indigo;
321 
323  static Color ivory;
324 
326  static Color khaki;
327 
329  static Color lavender;
330 
333 
335  static Color lawngreen;
336 
339 
341  static Color lightblue;
342 
345 
347  static Color lightcyan;
348 
351 
353  static Color lightgray;
354 
357 
359  static Color lightgrey;
360 
362  static Color lightpink;
363 
366 
369 
372 
375 
378 
381 
384 
386  static Color lime;
387 
389  static Color limegreen;
390 
392  static Color linen;
393 
395  static Color magenta;
396 
398  static Color maroon;
399 
402 
405 
408 
411 
414 
417 
420 
423 
426 
429 
431  static Color mintcream;
432 
434  static Color mistyrose;
435 
437  static Color moccasin;
438 
441 
443  static Color navy;
444 
446  static Color oldlace;
447 
449  static Color olive;
450 
452  static Color olivedrab;
453 
455  static Color orange;
456 
458  static Color orangered;
459 
461  static Color orchid;
462 
465 
467  static Color palegreen;
468 
471 
474 
477 
479  static Color peachpuff;
480 
482  static Color peru;
483 
485  static Color pink;
486 
488  static Color plum;
489 
492 
494  static Color purple;
495 
497  static Color red;
498 
500  static Color rosybrown;
501 
503  static Color royalblue;
504 
507 
509  static Color salmon;
510 
513 
515  static Color seagreen;
516 
518  static Color seashell;
519 
521  static Color sienna;
522 
524  static Color silver;
525 
527  static Color skyblue;
528 
530  static Color slateblue;
531 
533  static Color slategray;
534 
536  static Color slategrey;
537 
539  static Color snow;
540 
543 
545  static Color steelblue;
546 
548  static Color tan;
549 
551  static Color teal;
552 
554  static Color thistle;
555 
557  static Color tomato;
558 
560  static Color turquoise;
561 
563  static Color violet;
564 
566  static Color wheat;
567 
569  static Color white;
570 
573 
575  static Color yellow;
576 
579 
582 
583  static Color gray10;
584  static Color gray20;
585  static Color gray30;
586  static Color gray40;
587  static Color gray50;
588  static Color gray60;
589  static Color gray70;
590  static Color gray80;
591  static Color gray90;
592 
598  static Color find_color(const std::string &name);
599 
601  static std::vector<std::string> &get_names();
602 
606 
607 public:
609  void set_alpha(unsigned char value) { a = value; }
610 
612  void set_red(unsigned char value) { r = value; }
613 
615  void set_green(unsigned char value) { g = value; }
616 
618  void set_blue(unsigned char value) { b = value; }
619 
621  void set_alpha_f(float value) { a = (unsigned char) (value*255.0f); }
622 
624  void set_red_f(float value) { r = (unsigned char) (value*255.0f); }
625 
627  void set_green_f(float value) { g = (unsigned char) (value*255.0f); }
628 
630  void set_blue_f(float value) { b = (unsigned char) (value*255.0f); }
631 
633  void set_color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
634  { r = red; g = green; b = blue; a = alpha; }
635 
637  void set_rgba8(unsigned int color);
638 
640  void set_bgra8(unsigned int color);
641 
643  void set_rgb8(unsigned int color);
644 
646  void set_argb8(unsigned int color);
647 
649  void set_colorf(float red, float green, float blue, float alpha = 1.0f)
650  {
651  r = (unsigned char) (red * 255.0f);
652  g = (unsigned char) (green * 255.0f);
653  b = (unsigned char) (blue * 255.0f);
654  a = (unsigned char) (alpha * 255.0f);
655  }
656 
658 };
659 
661 class Colorf : public Vec4f
662 {
665 
666 public:
668  Colorf() : Vec4f(0.0f, 0.0f, 0.0f, 0.0f)
669  {
670  }
671 
681  Colorf(float r, float g, float b, float a = 1.0f) : Vec4f(r,g,b,a)
682  {
683  }
684 
691  Colorf(const float *array_rgba)
692  : Vec4f((array_rgba[0]), (array_rgba[1]), (array_rgba[2]), (array_rgba[3]))
693  {
694  }
695 
705  Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
706  : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
707  {
708  }
709 
719  Colorf(int r, int g, int b, int a=255)
720  : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
721  {
722  }
723 
724  explicit Colorf(const Color& color)
725  : Vec4f((color.get_red()/255.0f), (color.get_green()/255.0f), (color.get_blue()/255.0f), (color.get_alpha()/255.0f))
726  {
727  }
728 
735  Colorf(const std::string &hexstr)
736  {
737  *this = (Colorf)Color::find_color(hexstr);
738  }
739 
743 
744 public:
745 
749  float get_red() const { return r; }
750 
754  float get_green() const { return g; }
755 
759  float get_blue() const { return b; }
760 
764  float get_alpha() const { return a; }
765 
769 
770 public:
772  void normalize()
773  {
774  r = (r < 0.0f) ? 0.0f : ((r > 1.0f) ? 1.0f : r);
775  g = (g < 0.0f) ? 0.0f : ((g > 1.0f) ? 1.0f : g);
776  b = (b < 0.0f) ? 0.0f : ((b > 1.0f) ? 1.0f : b);
777  a = (a < 0.0f) ? 0.0f : ((a > 1.0f) ? 1.0f : a);
778  }
779 
781  void set_alpha(float value) { a = value; }
782 
784  void set_red(float value) { r = value; }
785 
787  void set_green(float value) { g= value; }
788 
790  void set_blue(float value) { b = value; }
791 
793  bool operator==(const Colorf &c) const
794  {
795  return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
796  }
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  operator Color() const
806  {
807  return Color(*this);
808  }
809 
813 
814 public:
817 
820 
822  static Colorf aqua;
823 
826 
828  static Colorf azure;
829 
831  static Colorf beige;
832 
834  static Colorf bisque;
835 
837  static Colorf black;
838 
841 
843  static Colorf blue;
844 
847 
849  static Colorf brown;
850 
853 
856 
859 
862 
864  static Colorf coral;
865 
868 
870  static Colorf cornsilk;
871 
873  static Colorf crimson;
874 
876  static Colorf cyan;
877 
879  static Colorf darkblue;
880 
882  static Colorf darkcyan;
883 
886 
888  static Colorf darkgray;
889 
892 
894  static Colorf darkgrey;
895 
898 
901 
904 
907 
910 
912  static Colorf darkred;
913 
916 
919 
922 
925 
928 
931 
934 
936  static Colorf deeppink;
937 
940 
942  static Colorf dimgray;
943 
945  static Colorf dimgrey;
946 
949 
952 
955 
958 
960  static Colorf fuchsia;
961 
964 
967 
969  static Colorf gold;
970 
973 
975  static Colorf gray;
976 
978  static Colorf grey;
979 
981  static Colorf green;
982 
985 
987  static Colorf honeydew;
988 
990  static Colorf hotpink;
991 
994 
996  static Colorf indigo;
997 
999  static Colorf ivory;
1000 
1002  static Colorf khaki;
1003 
1006 
1009 
1012 
1015 
1018 
1021 
1024 
1027 
1030 
1033 
1036 
1039 
1042 
1045 
1048 
1051 
1054 
1057 
1060 
1062  static Colorf lime;
1063 
1066 
1068  static Colorf linen;
1069 
1071  static Colorf magenta;
1072 
1074  static Colorf maroon;
1075 
1078 
1081 
1084 
1087 
1090 
1093 
1096 
1099 
1102 
1105 
1108 
1111 
1114 
1117 
1119  static Colorf navy;
1120 
1122  static Colorf oldlace;
1123 
1125  static Colorf olive;
1126 
1129 
1131  static Colorf orange;
1132 
1135 
1137  static Colorf orchid;
1138 
1141 
1144 
1147 
1150 
1153 
1156 
1158  static Colorf peru;
1159 
1161  static Colorf pink;
1162 
1164  static Colorf plum;
1165 
1168 
1170  static Colorf purple;
1171 
1173  static Colorf red;
1174 
1177 
1180 
1183 
1185  static Colorf salmon;
1186 
1189 
1192 
1195 
1197  static Colorf sienna;
1198 
1200  static Colorf silver;
1201 
1203  static Colorf skyblue;
1204 
1207 
1210 
1213 
1215  static Colorf snow;
1216 
1219 
1222 
1224  static Colorf tan;
1225 
1227  static Colorf teal;
1228 
1230  static Colorf thistle;
1231 
1233  static Colorf tomato;
1234 
1237 
1239  static Colorf violet;
1240 
1242  static Colorf wheat;
1243 
1245  static Colorf white;
1246 
1249 
1251  static Colorf yellow;
1252 
1255 
1258 
1259  static Colorf gray10;
1260  static Colorf gray20;
1261  static Colorf gray30;
1262  static Colorf gray40;
1263  static Colorf gray50;
1264  static Colorf gray60;
1265  static Colorf gray70;
1266  static Colorf gray80;
1267  static Colorf gray90;
1269 };
1270 
1271 }
1272 
static Color black
Definition: color.h:161
static Color gray30
Definition: color.h:585
void set_colorf(float red, float green, float blue, float alpha=1.0f)
Set color based on rgba color components in the range 0-1.
Definition: color.h:649
static Colorf beige
Definition: color.h:831
static Colorf green
Definition: color.h:981
static Color linen
Definition: color.h:392
static Colorf skyblue
Definition: color.h:1203
static Colorf snow
Definition: color.h:1215
static Colorf honeydew
Definition: color.h:987
static Colorf deepskyblue
Definition: color.h:939
bool operator!=(const Color &c) const
Color != Color operator (deep compare)
Definition: color.h:129
static Colorf ghostwhite
Definition: color.h:966
static Colorf mediumaquamarine
Definition: color.h:1077
static Color lightpink
Definition: color.h:362
Floating point color description class (for float).
Definition: color.h:661
static Colorf aliceblue
Definition: color.h:816
static Color darkgoldenrod
Definition: color.h:209
static Color ghostwhite
Definition: color.h:290
static Color seashell
Definition: color.h:518
static Colorf papayawhip
Definition: color.h:1152
static Color lime
Definition: color.h:386
static Color indianred
Definition: color.h:317
static Colorf mintcream
Definition: color.h:1107
static Colorf purple
Definition: color.h:1170
static Color fuchsia
Definition: color.h:284
static Color darksalmon
Definition: color.h:239
static Colorf gray80
Definition: color.h:1266
static Colorf white
Definition: color.h:1245
void set_color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Set color based on rgba color components in the range 0-255.
Definition: color.h:633
unsigned int get_abgr8() const
Returns the color in ABGR8888 format.
Definition: color.h:112
static Color midnightblue
Definition: color.h:428
Colorf(const std::string &hexstr)
Constructs a color.
Definition: color.h:735
static Colorf lightgrey
Definition: color.h:1035
static Color olive
Definition: color.h:449
bool operator==(const Colorf &c) const
Color == Color operator (deep compare)
Definition: color.h:793
static Colorf indianred
Definition: color.h:993
static Colorf yellow
Definition: color.h:1251
static Color blanchedalmond
Definition: color.h:164
static Colorf mistyrose
Definition: color.h:1110
static Color aliceblue
Definition: color.h:140
static Color darkslategrey
Definition: color.h:251
static Color antiquewhite
Definition: color.h:143
static Color lightgrey
Definition: color.h:359
Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Constructs a color.
Definition: color.h:705
void set_green_f(float value)
Set green color component, in the range 0-1.
Definition: color.h:627
static Color gray40
Definition: color.h:586
static Colorf cyan
Definition: color.h:876
static Color lightgreen
Definition: color.h:356
static Colorf steelblue
Definition: color.h:1221
static Colorf gray70
Definition: color.h:1265
static Color papayawhip
Definition: color.h:476
static Color aquamarine
Definition: color.h:149
static Color darkred
Definition: color.h:236
static Color purple
Definition: color.h:494
static Color ivory
Definition: color.h:323
static Color lightseagreen
Definition: color.h:368
Color()
Constructs a color.
Definition: color.h:55
static Colorf yellowgreen
Definition: color.h:1254
unsigned char get_green() const
Returns the green color component, in the range 0-255.
Definition: color.h:91
static Color thistle
Definition: color.h:554
static Color gold
Definition: color.h:293
static Color lightgoldenrodyellow
Definition: color.h:350
static Color steelblue
Definition: color.h:545
static Color orangered
Definition: color.h:458
static Colorf whitesmoke
Definition: color.h:1248
static Colorf slategrey
Definition: color.h:1212
unsigned char get_blue() const
Returns the blue color component, in the range 0-255.
Definition: color.h:94
static Color palegoldenrod
Definition: color.h:464
static Color saddlebrown
Definition: color.h:506
static Colorf lavender
Definition: color.h:1005
static Color gray20
Definition: color.h:584
static Colorf darkkhaki
Definition: color.h:897
static Color khaki
Definition: color.h:326
static Color lightslategray
Definition: color.h:374
static Color mediumpurple
Definition: color.h:410
float get_blue() const
Get Blue.
Definition: color.h:759
void set_green(float value)
Set green color component, in the range 0-1.
Definition: color.h:787
static Color deepskyblue
Definition: color.h:263
static Color lavender
Definition: color.h:329
static Color navajowhite
Definition: color.h:440
static Color oldlace
Definition: color.h:446
static Color lavenderblush
Definition: color.h:332
static Colorf lightgray
Definition: color.h:1029
static Color gray10
Definition: color.h:583
unsigned char get_alpha() const
Returns the alpha color component, in the range 0-255.
Definition: color.h:85
static Color chartreuse
Definition: color.h:182
bool operator==(const Color &c) const
Color == Color operator (deep compare)
Definition: color.h:123
static Colorf mediumspringgreen
Definition: color.h:1095
static Color olivedrab
Definition: color.h:452
static Colorf turquoise
Definition: color.h:1236
static Color rosybrown
Definition: color.h:500
static Color mediumvioletred
Definition: color.h:425
static Colorf gold
Definition: color.h:969
static Color wheat
Definition: color.h:566
float get_alpha() const
Get Alpha.
Definition: color.h:764
static Colorf khaki
Definition: color.h:1002
static Colorf teal
Definition: color.h:1227
static Color gray60
Definition: color.h:588
static Colorf cornsilk
Definition: color.h:870
bool operator!=(const Colorf &c) const
Color != Color operator (deep compare)
Definition: color.h:799
static Color navy
Definition: color.h:443
static Colorf azure
Definition: color.h:828
static Colorf forestgreen
Definition: color.h:957
static Color darkorange
Definition: color.h:230
void set_red(unsigned char value)
Set red color component, in the range 0-255.
Definition: color.h:612
static Color lightyellow
Definition: color.h:383
static Colorf lightyellow
Definition: color.h:1059
unsigned char get_red() const
Returns the red color component, in the range 0-255.
Definition: color.h:88
static Color peachpuff
Definition: color.h:479
static Color lightsalmon
Definition: color.h:365
static Colorf sienna
Definition: color.h:1197
static Color red
Definition: color.h:497
static Colorf coral
Definition: color.h:864
static Colorf darkslategrey
Definition: color.h:927
static Colorf mediumorchid
Definition: color.h:1083
static Color lightcoral
Definition: color.h:344
static Colorf lightsalmon
Definition: color.h:1041
static Color slateblue
Definition: color.h:530
static Colorf seagreen
Definition: color.h:1191
static Colorf darkolivegreen
Definition: color.h:903
static Colorf ivory
Definition: color.h:999
Colorf()
Constructs a color.
Definition: color.h:668
static Color gray90
Definition: color.h:591
static Colorf gray60
Definition: color.h:1264
static Color mediumslateblue
Definition: color.h:416
static Color magenta
Definition: color.h:395
static Colorf gray50
Definition: color.h:1263
static Colorf paleturquoise
Definition: color.h:1146
static Color royalblue
Definition: color.h:503
static Colorf navy
Definition: color.h:1119
static Colorf salmon
Definition: color.h:1185
static Colorf gray40
Definition: color.h:1262
static Colorf lightcyan
Definition: color.h:1023
float get_green_f() const
Returns the green color component, in the range 0-1.
Definition: color.h:103
static Colorf chartreuse
Definition: color.h:858
static Colorf dimgrey
Definition: color.h:945
static Colorf antiquewhite
Definition: color.h:819
static Color silver
Definition: color.h:524
static Colorf tan
Definition: color.h:1224
static Colorf lightskyblue
Definition: color.h:1047
static Colorf orchid
Definition: color.h:1137
static Colorf mediumblue
Definition: color.h:1080
static Color cornsilk
Definition: color.h:194
Type a
Definition: vec4.h:84
static Colorf darkslateblue
Definition: color.h:921
static Colorf seashell
Definition: color.h:1194
static Color violet
Definition: color.h:563
static Color mediumseagreen
Definition: color.h:413
static Color darkviolet
Definition: color.h:257
static Color gray80
Definition: color.h:590
static Colorf lightpink
Definition: color.h:1038
Colorf(const float *array_rgba)
Constructs a color.
Definition: color.h:691
static Color tomato
Definition: color.h:557
static Color forestgreen
Definition: color.h:281
static Color yellowgreen
Definition: color.h:578
static Color cyan
Definition: color.h:200
void set_alpha_f(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:621
static Color indigo
Definition: color.h:320
static Color moccasin
Definition: color.h:437
static Colorf tomato
Definition: color.h:1233
void set_red_f(float value)
Set red color component, in the range 0-1.
Definition: color.h:624
static Colorf gray
Definition: color.h:975
static Colorf royalblue
Definition: color.h:1179
static Colorf darkorange
Definition: color.h:906
static Colorf burlywood
Definition: color.h:852
static Color transparent
rgba(0, 0, 0, 0).
Definition: color.h:581
static Colorf darkgray
Definition: color.h:888
static Color bisque
Definition: color.h:158
static Colorf lightseagreen
Definition: color.h:1044
static Color peru
Definition: color.h:482
static Color palegreen
Definition: color.h:467
static Color cornflowerblue
Definition: color.h:191
static Color lightblue
Definition: color.h:341
Type r
Definition: vec4.h:81
static Color lightgray
Definition: color.h:353
static Color mintcream
Definition: color.h:431
static Color lawngreen
Definition: color.h:335
static Colorf silver
Definition: color.h:1200
static Color palevioletred
Definition: color.h:473
static Colorf darkslategray
Definition: color.h:924
static Color plum
Definition: color.h:488
static Color brown
Definition: color.h:173
static Colorf crimson
Definition: color.h:873
static Color gray
Definition: color.h:299
static Colorf moccasin
Definition: color.h:1113
static Colorf darkmagenta
Definition: color.h:900
static Colorf palevioletred
Definition: color.h:1149
static Colorf lightgreen
Definition: color.h:1032
static Colorf powderblue
Definition: color.h:1167
static Colorf darkviolet
Definition: color.h:933
static Color skyblue
Definition: color.h:527
float get_red_f() const
Returns the red color component, in the range 0-1.
Definition: color.h:100
static Colorf fuchsia
Definition: color.h:960
static Color firebrick
Definition: color.h:275
static Color mediumspringgreen
Definition: color.h:419
static Colorf darkgoldenrod
Definition: color.h:885
static Color sienna
Definition: color.h:521
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Constructs a color.
Definition: color.h:68
static Colorf bisque
Definition: color.h:834
static Colorf palegreen
Definition: color.h:1143
static Color orange
Definition: color.h:455
static Colorf lightslategray
Definition: color.h:1050
static Colorf orangered
Definition: color.h:1134
static Colorf lightblue
Definition: color.h:1017
static Color mistyrose
Definition: color.h:434
static Colorf maroon
Definition: color.h:1074
static Color seagreen
Definition: color.h:515
static Color salmon
Definition: color.h:509
float get_blue_f() const
Returns the blue color component, in the range 0-1.
Definition: color.h:106
static Color darkmagenta
Definition: color.h:224
void set_alpha(unsigned char value)
Set alpha color component, in the range 0-255.
Definition: color.h:609
float get_red() const
Get Red.
Definition: color.h:749
static Color lightsteelblue
Definition: color.h:380
static Color darkblue
Definition: color.h:203
static Colorf sandybrown
Definition: color.h:1188
static Color maroon
Definition: color.h:398
static Color coral
Definition: color.h:188
static Color honeydew
Definition: color.h:311
static Colorf gray10
Definition: color.h:1259
static Colorf mediumvioletred
Definition: color.h:1101
unsigned int get_bgra8() const
Returns the color in BGRA8888 format.
Definition: color.h:118
static Color darkslateblue
Definition: color.h:245
static Color teal
Definition: color.h:551
static Colorf darksalmon
Definition: color.h:915
static Color green
Definition: color.h:305
static Colorf grey
Definition: color.h:978
static Color lightskyblue
Definition: color.h:371
static Color gray70
Definition: color.h:589
static Colorf darkgreen
Definition: color.h:891
static Colorf dodgerblue
Definition: color.h:948
static Color paleturquoise
Definition: color.h:470
static Color yellow
Definition: color.h:575
static Colorf lime
Definition: color.h:1062
static Colorf plum
Definition: color.h:1164
static Colorf dimgray
Definition: color.h:942
static Color mediumaquamarine
Definition: color.h:401
static Colorf aquamarine
Definition: color.h:825
static Color powderblue
Definition: color.h:491
static Colorf linen
Definition: color.h:1068
static Colorf wheat
Definition: color.h:1242
static Color tan
Definition: color.h:548
unsigned int get_argb8() const
Returns the color in ARGB8888 format.
Definition: color.h:109
void set_blue_f(float value)
Set blue color component, in the range 0-1.
Definition: color.h:630
static Colorf floralwhite
Definition: color.h:954
static Color darkturquoise
Definition: color.h:254
static Colorf gray20
Definition: color.h:1260
static Colorf midnightblue
Definition: color.h:1104
static Colorf saddlebrown
Definition: color.h:1182
static Color darkkhaki
Definition: color.h:221
static Colorf violet
Definition: color.h:1239
static Color blueviolet
Definition: color.h:170
static Colorf lightsteelblue
Definition: color.h:1056
static Colorf deeppink
Definition: color.h:936
static Color aqua
Definition: color.h:146
static Colorf peru
Definition: color.h:1158
void set_green(unsigned char value)
Set green color component, in the range 0-255.
Definition: color.h:615
static Colorf aqua
Definition: color.h:822
static Colorf thistle
Definition: color.h:1230
static Colorf lavenderblush
Definition: color.h:1008
static Colorf magenta
Definition: color.h:1071
static Colorf gainsboro
Definition: color.h:963
static Color floralwhite
Definition: color.h:278
static Color darkorchid
Definition: color.h:233
Colorf(const Color &color)
Definition: color.h:724
unsigned int get_rgba8() const
Returns the color in RGBA8888 format.
Definition: color.h:115
static Color slategrey
Definition: color.h:536
static Color dodgerblue
Definition: color.h:272
static Colorf red
Definition: color.h:1173
static Colorf mediumpurple
Definition: color.h:1086
static Color darkgreen
Definition: color.h:215
static Colorf lightgoldenrodyellow
Definition: color.h:1026
float get_alpha_f() const
Returns the alpha color component, in the range 0-1.
Definition: color.h:97
static Color greenyellow
Definition: color.h:308
static Color beige
Definition: color.h:155
static Colorf greenyellow
Definition: color.h:984
static Colorf transparent
rgba(0, 0, 0, 0).
Definition: color.h:1257
static Colorf peachpuff
Definition: color.h:1155
static Colorf hotpink
Definition: color.h:990
static Color mediumturquoise
Definition: color.h:422
static Color blue
Definition: color.h:167
static Colorf navajowhite
Definition: color.h:1116
static Color cadetblue
Definition: color.h:179
void set_alpha(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:781
static Colorf firebrick
Definition: color.h:951
static Colorf darkorchid
Definition: color.h:909
Colorf(int r, int g, int b, int a=255)
Constructs a color.
Definition: color.h:719
static Color white
Definition: color.h:569
static Color mediumorchid
Definition: color.h:407
static Color lightslategrey
Definition: color.h:377
static Colorf gray30
Definition: color.h:1261
static Colorf olivedrab
Definition: color.h:1128
static Color dimgrey
Definition: color.h:269
static Colorf black
Definition: color.h:837
static Colorf palegoldenrod
Definition: color.h:1140
static Color lightcyan
Definition: color.h:347
Type b
Definition: vec4.h:83
static Color darkseagreen
Definition: color.h:242
static Color slategray
Definition: color.h:533
void set_blue(float value)
Set blue color component, in the range 0-1.
Definition: color.h:790
static Color burlywood
Definition: color.h:176
static Colorf mediumturquoise
Definition: color.h:1098
static Color sandybrown
Definition: color.h:512
static Color hotpink
Definition: color.h:314
static Color goldenrod
Definition: color.h:296
static Color mediumblue
Definition: color.h:404
static Color darkgrey
Definition: color.h:218
static Color deeppink
Definition: color.h:260
static Colorf lightslategrey
Definition: color.h:1053
static Colorf mediumseagreen
Definition: color.h:1089
void set_red(float value)
Set red color component, in the range 0-1.
Definition: color.h:784
static Colorf lawngreen
Definition: color.h:1011
static Color orchid
Definition: color.h:461
static Color darkslategray
Definition: color.h:248
static Colorf springgreen
Definition: color.h:1218
static Colorf darkcyan
Definition: color.h:882
static Colorf orange
Definition: color.h:1131
4D vector
Definition: size.h:48
static Colorf chocolate
Definition: color.h:861
static Color crimson
Definition: color.h:197
static Colorf darkgrey
Definition: color.h:894
static Color darkcyan
Definition: color.h:206
static Colorf brown
Definition: color.h:849
static Colorf darkred
Definition: color.h:912
static Color whitesmoke
Definition: color.h:572
static Colorf darkblue
Definition: color.h:879
static Colorf slateblue
Definition: color.h:1206
static Colorf mediumslateblue
Definition: color.h:1092
static Colorf darkturquoise
Definition: color.h:930
static Color azure
Definition: color.h:152
static Color gainsboro
Definition: color.h:287
static Color grey
Definition: color.h:302
static Color limegreen
Definition: color.h:389
static Color darkolivegreen
Definition: color.h:227
static Colorf goldenrod
Definition: color.h:972
void normalize()
Normalize the color by ensuring that all color values lie inbetween (0.0, 1.0)
Definition: color.h:772
static Colorf indigo
Definition: color.h:996
static Colorf lemonchiffon
Definition: color.h:1014
static Colorf gray90
Definition: color.h:1267
Color description class.
Definition: color.h:47
static Color lemonchiffon
Definition: color.h:338
static Color gray50
Definition: color.h:587
static Colorf lightcoral
Definition: color.h:1020
static Color turquoise
Definition: color.h:560
static Color chocolate
Definition: color.h:185
static Colorf oldlace
Definition: color.h:1122
static Colorf limegreen
Definition: color.h:1065
static Color pink
Definition: color.h:485
static Colorf cornflowerblue
Definition: color.h:867
static Color darkgray
Definition: color.h:212
static Colorf darkseagreen
Definition: color.h:918
Colorf(float r, float g, float b, float a=1.0f)
Constructs a color.
Definition: color.h:681
static Color springgreen
Definition: color.h:542
Type g
Definition: vec4.h:82
static Color snow
Definition: color.h:539
static Colorf cadetblue
Definition: color.h:855
static Colorf blueviolet
Definition: color.h:846
static Colorf pink
Definition: color.h:1161
static Color find_color(const std::string &name)
Find and returns the static color matching a string.
static Colorf blue
Definition: color.h:843
void set_blue(unsigned char value)
Set blue color component, in the range 0-255.
Definition: color.h:618
static Colorf slategray
Definition: color.h:1209
static Colorf rosybrown
Definition: color.h:1176
static Colorf olive
Definition: color.h:1125
static Colorf blanchedalmond
Definition: color.h:840
static Color dimgray
Definition: color.h:266
float get_green() const
Get Green.
Definition: color.h:754