CrossFramework Library
|
00001 00006 #if defined(XBASE_INCLUDED_COLOR4_HPP) 00007 #else 00008 #define XBASE_INCLUDED_COLOR4_HPP 00009 00010 //------------------------------------------------------------ 00011 #include <XBase/BuiltInTypes.hpp> 00012 #include <XBase/ShortString.hpp> 00013 00014 //------------------------------------------------------------ 00015 namespace XBase { 00016 struct Color3POD; 00017 struct Color4bPOD; 00018 struct Vector4POD; 00019 } 00020 00021 //------------------------------------------------------------ 00022 namespace XBase { 00024 00025 00026 struct Color4POD 00027 { 00028 //============================================================ 00030 00031 static const Color4POD Zero(); 00032 static const Color4POD One(); 00033 static const Color4POD UnitR(); 00034 static const Color4POD UnitG(); 00035 static const Color4POD UnitB(); 00036 static const Color4POD UnitA(); 00037 00038 00039 //============================================================ 00041 00042 f32 r; 00043 f32 g; 00044 f32 b; 00045 f32 a; 00046 00047 00048 //============================================================ 00050 00051 const Color3POD toRGB()const; 00052 const Color3POD toRRR()const; 00053 const Color3POD toGGG()const; 00054 const Color3POD toBBB()const; 00055 const Color3POD toAAA()const; 00056 const Color4POD toRRRR()const; 00057 const Color4POD toGGGG()const; 00058 const Color4POD toBBBB()const; 00059 const Color4POD toAAAA()const; 00060 const Color4bPOD toRGBAb()const; 00061 const Vector4POD toVector4()const; 00063 00064 //============================================================ 00066 00067 bool equals( const Color4POD& )const; 00068 bool equalsStrict( const Color4POD& )const; 00069 00070 00071 //============================================================ 00073 00074 const Color4POD add( f32 )const; 00075 const Color4POD sub( f32 )const; 00076 const Color4POD mul( f32 )const; 00077 const Color4POD div( f32 )const; 00078 const Color4POD add( const Color4POD& )const; 00079 const Color4POD sub( const Color4POD& )const; 00080 const Color4POD mul( const Color4POD& )const; 00081 const Color4POD div( const Color4POD& )const; 00082 const Color4POD neg()const; 00083 void addAssign( f32 ); 00084 void subAssign( f32 ); 00085 void mulAssign( f32 ); 00086 void divAssign( f32 ); 00087 void addAssign( const Color4POD& ); 00088 void subAssign( const Color4POD& ); 00089 void mulAssign( const Color4POD& ); 00090 void divAssign( const Color4POD& ); 00091 00092 00093 //============================================================ 00095 00096 const Color4POD operator+( f32 )const; 00097 const Color4POD operator-( f32 )const; 00098 const Color4POD operator*( f32 )const; 00099 const Color4POD operator/( f32 )const; 00100 const Color4POD operator+( const Color4POD& )const; 00101 const Color4POD operator-( const Color4POD& )const; 00102 const Color4POD operator*( const Color4POD& )const; 00103 const Color4POD operator/( const Color4POD& )const; 00104 const Color4POD operator-()const; 00105 Color4POD& operator+=( f32 ); 00106 Color4POD& operator-=( f32 ); 00107 Color4POD& operator*=( f32 ); 00108 Color4POD& operator/=( f32 ); 00109 Color4POD& operator+=( const Color4POD& ); 00110 Color4POD& operator-=( const Color4POD& ); 00111 Color4POD& operator*=( const Color4POD& ); 00112 Color4POD& operator/=( const Color4POD& ); 00113 00114 00115 //============================================================ 00117 00118 00119 const ShortString toShortString()const; 00121 }; 00122 00124 class Color4 : public Color4POD 00125 { 00126 public: 00127 //============================================================ 00129 00130 Color4(); 00131 Color4( const Color4POD& aRGBA ); 00132 Color4( f32 aR , f32 aG , f32 aB , f32 aA ); 00133 Color4( const Vector4POD& aVec ); 00134 00135 }; 00137 } 00138 //------------------------------------------------------------ 00139 #endif 00140 // EOF