SIBCColor.h

Go to the documentation of this file.
00001 //***************************************************************************************
00002 // File supervisor: Crosswalk team
00012 //***************************************************************************************
00013 
00014 //***************************************************************************************
00015 // Defines
00016 //***************************************************************************************
00017 #ifndef __CSIBCColor_H__
00018 #define __CSIBCColor_H__
00019 
00020 //***************************************************************************************
00021 // Includes
00022 //***************************************************************************************
00023 #include <math.h>
00024 #include <SIBCUtil.h>
00025 
00026 //***************************************************************************************
00027 // CSIBCColorf |
00028 //***************************************************************************************
00029 
00037 class XSICOREEXPORT CSIBCColorf
00038 {
00039     public:
00040 
00044         CSIBCColorf();
00045 
00050         CSIBCColorf( const CSIBCColorf & i_Color);
00051 
00059         CSIBCColorf(    const SI_Float i_fR,
00060                         const SI_Float i_fB,
00061                         const SI_Float i_fG,
00062                         const SI_Float i_fA = 1.0f );
00063 
00064         ~CSIBCColorf();
00065 
00066         // Comparison
00067 
00077         SI_Bool IsAlmostEqualTo(const CSIBCColorf& i_Color, const SI_Float i_Thresh) const;
00078 
00086         SI_Bool IsNull() const;
00087 
00095         SI_Bool IsNullAlpha() const;
00096 
00097         // Computed Info
00098 
00106         SI_Float GetDot(const CSIBCColorf& i_Color) const;
00107 
00115         SI_Float GetDotAlpha(const CSIBCColorf& i_Color) const;
00116 
00123         SI_Float GetDistanceFrom(const CSIBCColorf& i_Color) const;
00124 
00131         SI_Float GetDistanceFromAlpha(const CSIBCColorf& i_Color) const;
00132 
00138         SI_Float GetLength() const;
00139 
00145         SI_Float GetLengthAlpha() const;
00146 
00152         SI_Float GetSquaredLength() const;
00153 
00159         SI_Float GetSquaredLengthAlpha() const;
00160 
00170         SI_Float GetMaxComponent(SI_Int * i_pIndex) const;
00171 
00182         SI_Float GetMaxComponentAlpha(SI_Int * i_pIndex) const;
00183 
00193         SI_Float GetMinComponent(SI_Int * i_pIndex) const;
00194 
00205         SI_Float GetMinComponentAlpha(SI_Int * i_pIndex) const;
00206 
00207         // Components
00208 
00216         void Get(SI_Float* o_pR, SI_Float* o_pG, SI_Float* o_pB, SI_Float* o_pA) const;
00217 
00224         void Get(SI_Float* o_pR, SI_Float* o_pG, SI_Float* o_pB) const;
00225 
00234         CSIBCColorf& Set(SI_Float i_fR, SI_Float i_fG, SI_Float i_fB, SI_Float i_fA = 1.0f );
00235 
00236         // Operations
00237 
00242         CSIBCColorf& Normalize();
00243 
00248         CSIBCColorf& NormalizeAlpha();
00249 
00256         CSIBCColorf& SetNull( SI_Float alpha = 1.0f );
00257 
00265         CSIBCColorf& SetLength(const SI_Float in_dLength);
00266 
00273         CSIBCColorf& SetLengthAlpha(const SI_Float  );
00274 
00279         CSIBCColorf& Negate();
00280 
00285         CSIBCColorf& NegateAlpha();
00286 
00293         CSIBCColorf& Add(const CSIBCColorf& i_Color);
00294 
00302         CSIBCColorf& AddAlpha(const CSIBCColorf& i_Color);
00303 
00310         CSIBCColorf& Sub(const CSIBCColorf& i_Color);
00311 
00318         CSIBCColorf& SubAlpha(const CSIBCColorf& i_Color);
00319 
00325         CSIBCColorf& Scale(const SI_Float i_fFactor);
00326 
00333         CSIBCColorf& ScaleAlpha(const SI_Float i_fFactor);
00334 
00341         CSIBCColorf& MulComp(const CSIBCColorf& i_Color);
00342 
00349         CSIBCColorf& DivComp(const CSIBCColorf& i_Color);
00350 
00351         // overloaded operators
00352 
00360         SI_Bool operator == (const CSIBCColorf& i_Color) const;
00361 
00369         SI_Bool operator != (const CSIBCColorf& i_Color) const;
00370 
00378         CSIBCColorf operator+(const CSIBCColorf & i_Color);
00379 
00386         CSIBCColorf operator*(const SI_Float i_fFactor);
00387 
00389         SI_Float    m_fR;
00390 
00392         SI_Float    m_fG;
00393 
00395         SI_Float    m_fB;
00396 
00398         SI_Float    m_fA;
00399 
00400 protected:
00401 
00402 
00403 private:
00404 
00405 
00406 };
00407 
00408 //***************************************************************************************
00409 // CSIBCColorb |
00410 //***************************************************************************************
00411 
00419 class XSICOREEXPORT CSIBCColorb
00420 {
00421     public:
00422 
00426         CSIBCColorb();
00427 
00432         CSIBCColorb( const CSIBCColorb & i_Color);
00433 
00441         CSIBCColorb(    const SI_UByte  i_bR,
00442                         const SI_UByte  i_bG,
00443                         const SI_UByte  i_bB,
00444                         const SI_UByte  i_bA = 0 );
00445 
00446         ~CSIBCColorb();                             // Default Destructor
00447 
00448         // Comparison
00449 
00456         SI_Bool IsNull() const;
00457 
00464         SI_Bool IsNullAlpha() const;
00465 
00466         // Computed Info
00467 
00473         SI_UByte GetDot(const CSIBCColorb&  ) const;
00474 
00480         SI_UByte GetDotAlpha(const CSIBCColorb&  ) const;
00481 
00486         SI_Float GetDistanceFrom(const CSIBCColorb&  ) const;
00487 
00493         SI_Float GetDistanceFromAlpha(const CSIBCColorb&  ) const;
00494 
00500         SI_Float GetLength() const;
00501 
00507         SI_Float GetLengthAlpha() const;
00508 
00514         SI_Float GetSquaredLength() const;
00515 
00521         SI_Float GetSquaredLengthAlpha() const;
00522 
00532         SI_UByte GetMaxComponent(SI_Int * i_pIndex) const;
00533 
00544         SI_UByte GetMaxComponentAlpha(SI_Int * i_pIndex) const;
00545 
00555         SI_UByte GetMinComponent(SI_Int * i_pIndex) const;
00556 
00567         SI_UByte GetMinComponentAlpha(SI_Int * i_pIndex) const;
00568 
00569         // Components
00577         void Get(SI_UByte* o_pR, SI_UByte* o_pG, SI_UByte* o_pB, SI_UByte* o_pA) const;
00578 
00579 
00586         void Get(SI_UByte* o_pR, SI_UByte* o_pG, SI_UByte* o_pB) const;
00587 
00588 
00597         CSIBCColorb& Set(SI_UByte i_bR, SI_UByte i_bG, SI_UByte i_bB, SI_UByte i_bA = 255 );
00598 
00599         // Operations
00600 
00605         CSIBCColorb& Normalize();
00606 
00611         CSIBCColorb& NormalizeAlpha();
00612 
00619         CSIBCColorb& SetNull( SI_UByte alpha = 0 );
00620 
00628         CSIBCColorb& SetLength(const SI_Float in_dLength);
00629 
00637         CSIBCColorb& SetLengthAlpha(const SI_Float in_dLength);
00638 
00643         CSIBCColorb& Negate();
00644 
00649         CSIBCColorb& NegateAlpha();
00650 
00657         CSIBCColorb& Add(const CSIBCColorb& i_Color);
00658 
00666         CSIBCColorb& AddAlpha(const CSIBCColorb& i_Color);
00667 
00674         CSIBCColorb& Sub(const CSIBCColorb& i_Color);
00675 
00682         CSIBCColorb& SubAlpha(const CSIBCColorb& i_Color);
00683 
00689         CSIBCColorb& Scale(const SI_Float i_fFactor);
00690 
00697         CSIBCColorb& ScaleAlpha(const SI_Float i_fFactor);
00698 
00705         CSIBCColorb& MulComp(const CSIBCColorb& i_Color);
00706 
00713         CSIBCColorb& DivComp(const CSIBCColorb& i_Color);
00714 
00715         // overloaded operators
00722         SI_Bool operator == (const CSIBCColorb& i_Color) const;
00723 
00730         SI_Bool operator != (const CSIBCColorb& i_Color) const;
00731 
00739         CSIBCColorb operator+(const CSIBCColorb & i_Color);
00740 
00743         SI_UByte    m_fR;
00744 
00747         SI_UByte    m_fG;
00748 
00751         SI_UByte    m_fB;
00752 
00755         SI_UByte    m_fA;
00756 
00757 protected:
00758 
00759 
00760 private:
00761 
00762 
00763 };
00764 
00765 
00766 
00767 
00768 #endif // CSIBCColor