Visualization Library 2.0.0-b3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Colors.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2017, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef Color_INCLUDE_ONCE
33 #define Color_INCLUDE_ONCE
34 
35 // for more colors see: http://en.wikipedia.org/wiki/List_of_colors
36 
37 #include <vlCore/Vector4.hpp>
38 
39 namespace vl
40 {
41  inline fvec4 makeColor(unsigned int color)
42  {
43  fvec4 c;
44  c.r() = float(((color >> 24) & 0xFF) / 255.0f);
45  c.g() = float(((color >> 16) & 0xFF) / 255.0f);
46  c.b() = float(((color >> 8) & 0xFF) / 255.0f);
47  c.a() = float(((color >> 0) & 0xFF) / 255.0f);
48  return c;
49  }
50 
51  inline bool isValidColor( const fvec4& color ) { return color.a() >= 0; }
52 
53  static const fvec4 invalid_color = fvec4(0, 0, 0, -1);
54 
55  static const fvec4 black = makeColor(0x000000FF);
56 
57  static const fvec4 white = makeColor(0xFFFFFFFF);
58 
59  static const fvec4 red = makeColor(0xFF0000FF);
60 
61  static const fvec4 crimson = makeColor(0xDC143CFF);
62 
63  static const fvec4 violet = makeColor(0x9400D3FF);
64 
65  static const fvec4 orange = makeColor(0xFFA000FF);
66 
67  static const fvec4 yellow = makeColor(0xFFFF00FF);
68 
69  static const fvec4 gold = makeColor(0xFFD700FF);
70 
71  static const fvec4 green = makeColor(0x00FF00FF);
72 
73  static const fvec4 lightgreen = makeColor(0x90FF90FF);
74 
75  static const fvec4 darkgreen = makeColor(0x006400FF);
76 
77  static const fvec4 olivegreen = makeColor(0x556B2FFF);
78 
79  static const fvec4 blue = makeColor(0x0000FFFF);
80 
81  static const fvec4 darkblue = makeColor(0x00008BFF);
82 
83  static const fvec4 royalblue = makeColor(0x4169E1FF);
84 
85  static const fvec4 skyblue = makeColor(0x5555FFFF);
86 
87  static const fvec4 midnightblue = makeColor(0x191970FF);
88 
89  static const fvec4 fuchsia = makeColor(0xFF00FFFF);
90 
91  static const fvec4 aqua = makeColor(0x00FFFFFF);
92 
93  static const fvec4 pink = makeColor(0xffb6c1FF);
94 
95  static const fvec4 salmonpink = makeColor(0xFF91A4FF);
96 
97  static const fvec4 turquoise = makeColor(0x30D5C8FF);
98 
99  static const fvec4 darkturquoise = makeColor(0x008080FF);
100 
101  static const fvec4 gray = makeColor(0xA9A9A9FF);
102 
103  static const fvec4 lightgray = makeColor(0xD3D3D3FF);
104 
105  static const fvec4 darkgray = makeColor(0x808080FF);
106 }
107 
108 #endif
Vector4< float > fvec4
A 4 components vector with float precision.
Definition: Vector4.hpp:279
const T_Scalar & r() const
Definition: Vector4.hpp:111
Visualization Library main namespace.
const T_Scalar & g() const
Definition: Vector4.hpp:112
bool isValidColor(const fvec4 &color)
Definition: Colors.hpp:51
const T_Scalar & b() const
Definition: Vector4.hpp:113
fvec4 makeColor(unsigned int color)
Definition: Colors.hpp:41
const T_Scalar & a() const
Definition: Vector4.hpp:114