OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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 <iostream>
29 
30 #include <osg/Vec4>
31 #include <osg/io_utils> // for the operator<< and operator>> for Vec4
32 
33 #include "WExportCommon.h"
34 
35 /**
36  * Represents a RGBA Color.
37  */
38 typedef osg::Vec4 WColor;
39 
40 /**
41  * Creates a color from a hue, saturation and value (HSV).
42  *
43  * \ingroup Color utils
44  *
45  * \param h hue
46  * \param s saturation
47  * \param v value
48  *
49  * \return The same color but in rgba format.
50  */
51 WColor OWCOMMON_EXPORT convertHSVtoRGBA( double h, double s, double v );
52 
53 /**
54  * Computes the inverse of this color in means of RGB space. The alpha value is untouched.
55  *
56  * \ingroup Color utils
57  *
58  * \param other The color (RGBA) from which the inverse should be calculated.
59  */
60 WColor OWCOMMON_EXPORT inverseColor( const WColor& other );
61 
62 /**
63  * Some default colors.
64  */
65 namespace defaultColor
66 {
67  // \cond Suppress_Doxygen
68  static const WColor GREEN( 0.0, 1.0, 0.0, 1.0 ); //!< Default for green
69  static const WColor RED( 1.0, 0.0, 0.0, 1.0 ); //!< Default for red
70  static const WColor BLUE( 0.0, 0.0, 1.0, 1.0 ); //!< Default for blue
71  // \endcond
72 }
73 
74 #endif // WCOLOR_H