osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthSymbology/Color

Go to the documentation of this file.
00001 /* --*-c++-*-- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003  * Copyright 2008-2010 Pelican Mapping
00004  * http://osgearth.org
00005  *
00006  * osgEarth is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018  */
00019 #ifndef OSGEARTHSYMBOLOGY_COLOR_H
00020 #define OSGEARTHSYMBOLOGY_COLOR_H 1
00021 
00022 #include <osgEarthSymbology/Common>
00023 #include <osg/Vec4f>
00024 #include <string>
00025 
00026 namespace osgEarth { namespace Symbology
00027 {
00031     struct OSGEARTHSYMBOLOGY_EXPORT Color : public osg::Vec4f
00032     {
00033         enum Format {
00034             RGBA,
00035             ABGR
00036         };
00037 
00039         Color() : osg::Vec4f(1,1,1,1) { }
00040 
00042         Color( const Color& rhs ) : osg::Vec4f(rhs) { }
00043 
00045         Color( const osg::Vec4f& rgba ) : osg::Vec4f(rgba) { }
00046 
00048         Color( const Color& rhs, float a );
00049 
00051         Color( float r, float g, float b, float a = 1.0f )
00052             : osg::Vec4f(r, g, b, a) { }
00053 
00055         Color( unsigned rgba );
00056 
00058         Color( const std::string& html, Format format =RGBA );
00059 
00061         std::string toHTML( Format format =RGBA ) const;
00062 
00064         Color brightness( float factor ) const;
00065 
00066         // built in colors
00067         // http://en.wikipedia.org/wiki/Web_colors#HTML_color_names
00068 
00069         static Color White;
00070         static Color Silver;
00071         static Color Gray;
00072         static Color Black;
00073         static Color Red;
00074         static Color Maroon;
00075         static Color Yellow;
00076         static Color Olive;
00077         static Color Lime;
00078         static Color Green;
00079         static Color Aqua;
00080         static Color Teal;
00081         static Color Blue;
00082         static Color Navy;
00083         static Color Fuchsia;
00084         static Color Purple;
00085         static Color Orange;
00086         static Color Cyan;
00087 
00088         static Color DarkGray;
00089     };
00090 
00091 } } // namespace osgEarth::Symbology
00092 
00093 #endif // OSGEARTHSYMBOLOGY_COLOR_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines