OMKColor.h

Go to the documentation of this file.
00001 /*
00002  * Software OpenMASK-3DVis © INRIA 1993-2002, thereinafter the Software
00003  * 
00004  * The software has been developed within the Siames Project. 
00005  * INRIA hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.500027.00.S.P.2001.000.41200
00009  *
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA for the software may use 
00015  * this file in accordance with that specific license         
00016  *
00017  */
00018 //-----------------------------------------------------------------------------
00019 #ifndef OMKColorHEADER
00020 #define OMKColorHEADER
00021 
00022 #include "OMKOpenMASK.h"
00023 #include <iostream>
00024 
00025 
00026 namespace OMK 
00027 {
00028 class OutgoingSynchronisationMessage ;
00029 class IncomingSynchronisationMessage ;
00030 namespace Type 
00031 {
00032 class Color ;
00033 } // namespace Type 
00034 } // namespace OMK
00035 
00037 
00038 
00039 
00040 OMK_API std::ostream& operator << ( std::ostream& out, const OMK::Type::Color& color ); 
00041 
00044 OMK_API std::istream& operator >> ( std::istream& in, OMK::Type::Color& color ) ;
00045 
00048 OMK_API OMK::OutgoingSynchronisationMessage& operator << 
00049   ( OMK::OutgoingSynchronisationMessage& out, const OMK::Type::Color& color ) ;
00050 
00053 OMK_API OMK::IncomingSynchronisationMessage& operator >> 
00054   ( OMK::IncomingSynchronisationMessage& in, OMK::Type::Color& color ) ;
00056 
00057 namespace OMK 
00058 {
00059   namespace Type 
00060   {
00082 class OMK_API Color
00083 {
00084  public:
00085 
00087 
00088 
00089   Color() ;
00091   Color( const Color& color ) ;
00093   Color( float r, float g, float b, float a = 1.0f ) ;
00095   virtual ~Color() ;
00097   
00099 
00100 
00101 
00102   float getR() const { return _array[0] ; }
00105   float getG() const { return _array[1] ; }
00108   float getB() const { return _array[2] ; }
00111   float getA() const { return _array[3] ; }
00113   
00115 
00116 
00117 
00118   void setR( float r ) { _array[0] = r ; }
00121   void setG( float g ) { _array[1] = g ; }
00124   void setB( float b ) { _array[2] = b ; }
00127   void setA( float a ) { _array[3] = a ; }
00129 
00130 
00131 
00132   friend OMK_API bool operator == ( const Color& c0, const Color& c1 ) ;
00134   friend OMK_API bool operator != ( const Color& c0, const Color& c1 ) ;
00135   Color& operator = ( const Color& color ) { if ( this != &color ) _copy( color ) ; return *this ; }
00136   Color& operator = ( float v[4] ) ;  
00137   float& operator[] ( int i ) { return _array[i] ; }
00138   float operator[] ( int i ) const { return _array[i] ; }
00140 
00141 
00142 
00143 
00144   friend std::ostream& ::operator << ( std::ostream& out, const Color& color ); 
00145 
00148   friend std::istream& ::operator >> ( std::istream& in, Color& color ) ;
00149 
00152   friend OMK::OutgoingSynchronisationMessage& ::operator << 
00153     ( OMK::OutgoingSynchronisationMessage& out, const Color& color ) ;
00154 
00157   friend OMK::IncomingSynchronisationMessage& ::operator >> 
00158     ( OMK::IncomingSynchronisationMessage& in, Color& color ) ;
00160 
00161 private:
00163   void _copy( const Color& color ) ;
00165   float _array[ 4 ] ;
00166 };
00167 
00168   } // namespace Type
00169 } // namespace OMK
00170 
00171 #endif

logo OpenMask

Documentation generated on Mon Jun 9 11:45:55 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007