OpenWalnut  1.5.0dev
WColor.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WCOLOR_H
26 #define WCOLOR_H
27 
28 #include <osg/Vec4>
29 #include <osg/io_utils> // for the operator<< and operator>> for Vec4
30 
31 
32 
33 /**
34  * Represents a RGBA Color.
35  */
36 typedef osg::Vec4 WColor;
37 
38 /**
39  * Creates a color from a hue, saturation and value (HSV).
40  *
41  * \ingroup Color utils
42  *
43  * \param h hue
44  * \param s saturation
45  * \param v value
46  *
47  * \return The same color but in rgba format.
48  */
49 WColor convertHSVtoRGBA( double h, double s, double v );
50 
51 /**
52  * Computes the inverse of this color in means of RGB space. The alpha value is untouched.
53  *
54  * \ingroup Color utils
55  *
56  * \param other The color (RGBA) from which the inverse should be calculated.
57  */
58 WColor inverseColor( const WColor& other );
59 
60 /**
61  * Some default colors.
62  */
63 namespace defaultColor
64 {
65  // \cond Suppress_Doxygen
66  static const WColor DARKRED( 0.5, 0.0, 0.0, 1.0 ); //!< Default for dark red
67  static const WColor RED( 1.0, 0.0, 0.0, 1.0 ); //!< Default for red
68  static const WColor LIGHTRED( 1.0, 0.5, 0.5, 1.0 ); //!< Default for lighter red
69 
70  static const WColor DARKGREEN( 0.0, 0.5, 0.0, 1.0 ); //!< Default for a dark green
71  static const WColor GREEN( 0.0, 1.0, 0.0, 1.0 ); //!< Default for green
72  static const WColor LIGHTGREEN( 0.5, 1.0, 0.5, 1.0 ); //!< Default for lighter green
73 
74  static const WColor DARKBLUE( 0.0, 0.0, 0.5, 1.0 ); //!< Default for blue
75  static const WColor BLUE( 0.0, 0.0, 1.0, 1.0 ); //!< Default for blue
76  static const WColor LIGHTBLUE( 0.5, 0.5, 1.0, 1.0 ); //!< Default for blue
77 
78  static const WColor DARKYELLOW( 0.5, 0.5, 0.0, 1.0 ); //!< Default for yellow
79  static const WColor YELLOW( 1.0, 1.0, 0.0, 1.0 ); //!< Default for yellow
80  static const WColor LIGHTYELLOW( 1.0, 1.0, 0.5, 1.0 ); //!< Default for yellow
81 
82  static const WColor ORANGE( 1.0, 0.5, 0.0, 1.0 ); //!< Default for orange
83 
84  static const WColor VIOLET( 0.5, 0.0, 0.5, 1.0 ); //!< Default for violet (darker pink)
85  static const WColor PINK( 1.0, 0.0, 1.0, 1.0 ); //!< Default for pink
86 
87  static const WColor TEAL( 0.0, 0.5, 0.5, 1.0 ); //!< Default for darker cyan (teal)
88  static const WColor CYAN( 0.0, 1.0, 1.0, 1.0 ); //!< Default for cyan
89 
90  static const WColor BLACK( 0.0, 0.0, 0.0, 1.0 ); //!< Default for black
91  static const WColor GRAY25( 0.25, 0.25, 0.25, 1.0 ); //!< Default for gray
92  static const WColor GRAY50( 0.5, 0.5, 0.5, 1.0 ); //!< Default for gray
93  static const WColor GRAY75( 0.75, 0.75, 0.75, 1.0 ); //!< Default for gray
94  static const WColor WHITE( 1.0, 1.0, 1.0, 1.0 ); //!< Default for white
95  // \endcond
96 
97  /**
98  * The size of the default palette
99  */
100  static const size_t DefaultPaletteSize = 22;
101 
102  /**
103  * This array is a simple palette definition containing the above colors. This palette is probably not very usable for all your special
104  * needs. DO NOT add thousand other palettes here. Define them for yourself, in your module.
105  */
106  extern const WColor DefaultPalette[22];
107 }
108 
109 #endif // WCOLOR_H
Some default colors.
Definition: WColor.cpp:36
static const size_t DefaultPaletteSize
The size of the default palette.
Definition: WColor.h:100
const WColor DefaultPalette[22]
the default palette colors
Definition: WColor.cpp:38