Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

X:/dropbox/visualizationlibrary/src/vlCore/Colors.hpp

Go to the documentation of this file.
00001 /**************************************************************************************/
00002 /*                                                                                    */
00003 /*  Visualization Library                                                             */
00004 /*  http://www.visualizationlibrary.org                                               */
00005 /*                                                                                    */
00006 /*  Copyright (c) 2005-2010, Michele Bosi                                             */
00007 /*  All rights reserved.                                                              */
00008 /*                                                                                    */
00009 /*  Redistribution and use in source and binary forms, with or without modification,  */
00010 /*  are permitted provided that the following conditions are met:                     */
00011 /*                                                                                    */
00012 /*  - Redistributions of source code must retain the above copyright notice, this     */
00013 /*  list of conditions and the following disclaimer.                                  */
00014 /*                                                                                    */
00015 /*  - Redistributions in binary form must reproduce the above copyright notice, this  */
00016 /*  list of conditions and the following disclaimer in the documentation and/or       */
00017 /*  other materials provided with the distribution.                                   */
00018 /*                                                                                    */
00019 /*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND   */
00020 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED     */
00021 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE            */
00022 /*  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR  */
00023 /*  ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES    */
00024 /*  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;      */
00025 /*  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON    */
00026 /*  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT           */
00027 /*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS     */
00028 /*  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                      */
00029 /*                                                                                    */
00030 /**************************************************************************************/
00031 
00032 #ifndef Color_INCLUDE_ONCE
00033 #define Color_INCLUDE_ONCE
00034 
00035 // for more colors see: http://en.wikipedia.org/wiki/List_of_colors
00036 
00037 #include <vlCore/Vector4.hpp>
00038 
00039 namespace vl
00040 {
00041   inline fvec4 makeColor(unsigned int color)
00042   {
00043     fvec4 c;
00044     c.r() = float(((color >> 24) & 0xFF) / 255.0f);
00045     c.g() = float(((color >> 16) & 0xFF) / 255.0f);
00046     c.b() = float(((color >>  8) & 0xFF) / 255.0f);
00047     c.a() = float(((color >>  0) & 0xFF) / 255.0f);
00048     return c;    
00049   }
00050 
00051   inline bool isValidColor( const fvec4& color ) { return color.a() >= 0; }
00052 
00053   static const fvec4 invalid_color = fvec4(0, 0, 0, -1);
00054   
00055   static const fvec4 black = makeColor(0x000000FF);
00056   
00057   static const fvec4 white = makeColor(0xFFFFFFFF);
00058   
00059   static const fvec4 red = makeColor(0xFF0000FF);
00060   
00061   static const fvec4 crimson = makeColor(0xDC143CFF);
00062   
00063   static const fvec4 violet = makeColor(0x9400D3FF);
00064   
00065   static const fvec4 orange = makeColor(0xFFA000FF);
00066   
00067   static const fvec4 yellow = makeColor(0xFFFF00FF);
00068   
00069   static const fvec4 gold = makeColor(0xFFD700FF);
00070   
00071   static const fvec4 green = makeColor(0x00FF00FF);
00072   
00073   static const fvec4 lightgreen = makeColor(0x90FF90FF);
00074   
00075   static const fvec4 darkgreen = makeColor(0x006400FF);
00076   
00077   static const fvec4 olivegreen = makeColor(0x556B2FFF);
00078   
00079   static const fvec4 blue = makeColor(0x0000FFFF);
00080   
00081   static const fvec4 darkblue = makeColor(0x00008BFF);
00082   
00083   static const fvec4 royalblue = makeColor(0x4169E1FF);
00084   
00085   static const fvec4 skyblue = makeColor(0x5555FFFF);  
00086   
00087   static const fvec4 midnightblue = makeColor(0x191970FF);
00088   
00089   static const fvec4 fuchsia = makeColor(0xFF00FFFF);
00090   
00091   static const fvec4 aqua = makeColor(0x00FFFFFF);
00092   
00093   static const fvec4 pink = makeColor(0xffb6c1FF);
00094   
00095   static const fvec4 salmonpink = makeColor(0xFF91A4FF);
00096   
00097   static const fvec4 turquoise = makeColor(0x30D5C8FF); 
00098   
00099   static const fvec4 darkturquoise = makeColor(0x008080FF);
00100   
00101   static const fvec4 gray = makeColor(0xA9A9A9FF);
00102   
00103   static const fvec4 lightgray = makeColor(0xD3D3D3FF);
00104   
00105   static const fvec4 darkgray = makeColor(0x808080FF);
00106 }
00107 
00108 #endif

Visualization Library 2011.09.1160 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 2 2013 13:40:28.
Permission is granted to use this page to write and publish articles regarding Visualization Library.