Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

Colour.hh

Go to the documentation of this file.
00001 /*
00002 
00003     libpdf++: a C++ Free library to generate PDF file
00004     Copyright (C) 2002 Nestal Wan
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Lesser General Public
00008     License as published by the Free Software Foundation; either
00009     version 2.1 of the License, or (at your option) any later version.
00010 
00011     This library 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 GNU
00014     Lesser General Public License for more details.
00015 
00016     You should have received a copy of the GNU Lesser General Public
00017     License along with this library; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 */
00027 #ifndef __COLOUR_HEADER_INCLUDED_HEADER_INCLUDED__
00028 #define __COLOUR_HEADER_INCLUDED_HEADER_INCLUDED__
00029 
00030 #include <iosfwd>
00031 
00032 namespace pdf { namespace util {
00033 
00037 class CColour
00038 {
00039 private :
00040     double m_red, m_green, m_blue ;
00041 
00042 public :
00043     static const double max = 1.0f, min = 0.0f ;
00044 
00045 public :
00046     CColour( ) ;
00047     CColour( double red, double green, double blue ) ;
00048 
00049     double R( ) const { return m_red ; }
00050     double G( ) const { return m_green ; }
00051     double B( ) const { return m_blue ; }
00052     
00053     void R( double red )   { m_red = red ; }
00054     void G( double green ) { m_green = green ; }
00055     void B( double blue )  { m_blue = blue ; }
00056     
00057     std::ostream& Print( std::ostream& os ) const ;
00058 
00059     bool operator==( const CColour& colour ) const ;
00060     bool operator!=( const CColour& colour ) const
00061         { return !operator==( colour ) ; }
00062 } ;
00063 
00064 inline std::ostream& operator<<( std::ostream& os, const CColour& colour )
00065 {
00066     return colour.Print( os ) ;
00067 }
00068 
00070 
00071 const CColour Red( ) ;
00072 const CColour Green( ) ;
00073 const CColour Blue( ) ;
00074 const CColour Purple( ) ;
00075 const CColour Cyan( ) ;
00076 const CColour Yellow( ) ;
00077 const CColour Orange( ) ;
00079 
00080 } } // end of namespace
00081 
00082 #endif

Generated on Sun Feb 2 09:16:04 2003 for libpdf++ by doxygen1.2.16