00001 ////////////////////////////////////////////////////////////////////// 00002 // Copyright (c) 2001-2002 David Pritchard <drpritch@alumni.uwaterloo.ca> 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either 00007 // version 2 of the License, or (at your option) any later 00008 // version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 00019 #ifndef col_colColourRGB_h 00020 #define col_colColourRGB_h 00021 00022 #ifndef col_package_h 00023 #include <freecloth/colour/package.h> 00024 #endif 00025 00026 //////////////////////////////////////////////////////////////////////////////// 00027 // FORWARD DECLARATIONS 00028 00029 //////////////////////////////////////////////////////////////////////////////// 00030 /*! 00031 * \class ColColourRGB freecloth/colour/colColourRGB.h 00032 * \brief Definition of a colour in an RGB colourspace. 00033 * 00034 * Very rudimentary. 00035 */ 00036 class ColColourRGB 00037 { 00038 public: 00039 00040 // ----- classes ----- 00041 00042 // ----- member functions ----- 00043 00044 ColColourRGB(); 00045 ColColourRGB( Float r, Float g, Float b ); 00046 //! Linear combination of two colours. 00047 ColColourRGB( 00048 const ColColourRGB& colA, 00049 const ColColourRGB& colB, 00050 Float fracA 00051 ); 00052 // Default copy constructor is fine. 00053 // Default assignment operator is fine. 00054 00055 ColColourRGB& operator*=( Float val ); 00056 ColColourRGB operator*( Float val ) const; 00057 00058 00059 // ----- static data members ----- 00060 00061 static const ColColourRGB BLACK; 00062 static const ColColourRGB WHITE; 00063 static const ColColourRGB RED; 00064 static const ColColourRGB GREEN; 00065 static const ColColourRGB BLUE; 00066 static const ColColourRGB CYAN; 00067 static const ColColourRGB MAGENTA; 00068 static const ColColourRGB YELLOW; 00069 00070 // ----- data members ----- 00071 00072 Float _r,_g,_b; 00073 }; 00074 00075 //////////////////////////////////////////////////////////////////////////////// 00076 // GLOBAL FUNCTIONS 00077 // 00078 std::ostream& operator<<( std::ostream&, const ColColourRGB& ); 00079 00080 #endif