CSIBCColorf Class Reference
Class representing RGBA colours.
More...#include <SIBCColor.h>
List of all members.
|
|
Public Member Functions
|
| |
CSIBCColorf () |
| |
CSIBCColorf (const CSIBCColorf &i_Color) |
| |
CSIBCColorf (const SI_Float i_fR, const SI_Float i_fB, const SI_Float i_fG, const SI_Float i_fA=1.0f) |
| SI_Bool |
IsAlmostEqualTo (const CSIBCColorf &i_Color, const SI_Float i_Thresh) const |
| SI_Bool |
IsNull () const |
| SI_Bool |
IsNullAlpha () const |
| SI_Float |
GetDot (const CSIBCColorf &i_Color) const |
| SI_Float |
GetDotAlpha (const CSIBCColorf &i_Color) const |
| SI_Float |
GetDistanceFrom (const CSIBCColorf &i_Color) const |
| SI_Float |
GetDistanceFromAlpha (const CSIBCColorf &i_Color) const |
| SI_Float |
GetLength () const |
| SI_Float |
GetLengthAlpha () const |
| SI_Float |
GetSquaredLength () const |
| SI_Float |
GetSquaredLengthAlpha () const |
| SI_Float |
GetMaxComponent (SI_Int *i_pIndex) const |
| SI_Float |
GetMaxComponentAlpha (SI_Int *i_pIndex) const |
| SI_Float |
GetMinComponent (SI_Int *i_pIndex) const |
| SI_Float |
GetMinComponentAlpha (SI_Int *i_pIndex) const |
| void |
Get (SI_Float *o_pR, SI_Float *o_pG, SI_Float *o_pB, SI_Float *o_pA) const |
| void |
Get (SI_Float *o_pR, SI_Float *o_pG, SI_Float *o_pB) const |
| CSIBCColorf & |
Set (SI_Float i_fR, SI_Float i_fG, SI_Float i_fB, SI_Float i_fA=1.0f) |
| CSIBCColorf & |
Normalize () |
| CSIBCColorf & |
NormalizeAlpha () |
| CSIBCColorf & |
SetNull (SI_Float alpha=1.0f) |
| CSIBCColorf & |
SetLength (const SI_Float in_dLength) |
| CSIBCColorf & |
SetLengthAlpha (const SI_Float) |
| CSIBCColorf & |
Negate () |
| CSIBCColorf & |
NegateAlpha () |
| CSIBCColorf & |
Add (const CSIBCColorf &i_Color) |
| CSIBCColorf & |
AddAlpha (const CSIBCColorf &i_Color) |
| CSIBCColorf & |
Sub (const CSIBCColorf &i_Color) |
| CSIBCColorf & |
SubAlpha (const CSIBCColorf &i_Color) |
| CSIBCColorf & |
Scale (const SI_Float i_fFactor) |
| CSIBCColorf & |
ScaleAlpha (const SI_Float i_fFactor) |
| CSIBCColorf & |
MulComp (const CSIBCColorf &i_Color) |
| CSIBCColorf & |
DivComp (const CSIBCColorf &i_Color) |
| SI_Bool |
operator== (const CSIBCColorf &i_Color) const |
| SI_Bool |
operator!= (const CSIBCColorf &i_Color) const |
| CSIBCColorf |
operator+ (const CSIBCColorf &i_Color) |
| CSIBCColorf |
operator * (const SI_Float i_fFactor) |
Public Attributes
|
| SI_Float |
m_fR |
| SI_Float |
m_fG |
| SI_Float |
m_fB |
| SI_Float |
m_fA |
Detailed Description
Class representing RGBA colours.
Represents colours and stores RGBA values as floating point values. Member functions with the "Alpha" suffix operate on alpha as well as RGB, whereas their counterparts operate only on RGB color component values. This class is analogous to the CSIBCColorb class, which uses unsigned bytes to represent color components, instead of floating-point numbers.
Constructor & Destructor Documentation
Default constructor. Creates a new color object, with uninitialized color values.
Copy Constructor. Creates a new color object, based on the values in the i_Color object.
- Parameters:
-
|
|
i_Color |
Color object to copy values from for the new object. |
| CSIBCColorf |
( |
const SI_Float |
i_fR, |
|
|
|
const SI_Float |
i_fB, |
|
|
|
const SI_Float |
i_fG, |
|
|
|
const SI_Float |
i_fA = 1.0f |
|
|
|
) |
|
|
|
Constructor. Creates a new color with the given color component values.
- Parameters:
-
|
|
i_fR |
Value to set the red component of the color to. |
|
|
i_fB |
Value to set the blue component of the color to. |
|
|
i_fG |
Value to set the green component of the color to. |
|
|
i_fA |
Value to set the alpha component of the color to (defaults to 1.0f). |
Member Function Documentation
| SI_Bool IsAlmostEqualTo |
( |
const CSIBCColorf & |
i_Color, |
|
|
|
const SI_Float |
i_Thresh |
|
|
|
) |
|
|
const |
Determines whether the color i_Color and this color are equal to each other, within a given limit. This is necessary because of floating-point round-off errors.
- Parameters:
-
|
|
i_Color |
The color to compare this color with. |
|
|
i_Thresh |
Ignored. The comparison uses PICO_EPS for the comparison threshhold. |
- Returns:
- SI_Bool TRUE if all component values of the two colors are no less than PICO_EPS different, FALSE otherwise.
- See also:
- CSIBCColorf::operator==
CSIBCColorf::operator!=
Determines whether all component values (excluding alpha) of this color are zero. Due to floating-point round-off error, PICO_EPS is used for the zero comparison.
- Returns:
- SI_Bool TRUE if all component values are equal to zero, FALSE otherwise.
- See also:
- CSIBCColorf::IsNullAlpha
CSIBCColorf::SetNull
| SI_Bool IsNullAlpha |
( |
|
) |
const |
Determines whether all component values (including alpha) of this color are zero. Due to floating-point round-off error, PICO_EPS is used for the zero comparison.
- Returns:
- SI_Bool TRUE if all component values are equal to zero, FALSE otherwise.
- See also:
- CSIBCColorf::IsNull
CSIBCColorf::SetNull
Gets the dot-product of this color with another color. This is the sum of the scalar multiplication of all corresponding component values in the two colors (excluding alpha).
- Parameters:
-
|
|
i_Color |
Color object to get this object's dot product with. |
- Returns:
- SI_Float Dot product of the two colors.
- See also:
- CSIBCColorf::GetDotAlpha
| SI_Float GetDotAlpha |
( |
const CSIBCColorf & |
i_Color |
) |
const |
Gets the dot-product of this color with another color. This is the sum of the scalar multiplication of all corresponding component values in the two colors (including alpha).
- Parameters:
-
|
|
i_Color |
Color object to get this object's dot product with. |
- Returns:
- SI_Float Dot product of the two colors.
- See also:
- CSIBCColorf::GetDot
| SI_Float GetDistanceFrom |
( |
const CSIBCColorf & |
i_Color |
) |
const |
Computes the distance between the this color and i_Color in RGB space (i.e excluding alpha).
- Parameters:
-
|
|
i_Color |
Color object to get this object's distance from. |
- Returns:
- SI_Float Distance between the two colors in RGB space.
- See also:
- CSIBCColorf::GetDistanceFromAlpha
| SI_Float GetDistanceFromAlpha |
( |
const CSIBCColorf & |
i_Color |
) |
const |
Computes the distance between the this color and i_Color in RGBA space (i.e including alpha).
- Parameters:
-
|
|
i_Color |
Color object to get this object's distance from. |
- Returns:
- SI_Float Distance between the two colors in RGBA space.
- See also:
- CSIBCColorf::GetDistanceFrom
| SI_Float GetLength |
( |
|
) |
const |
Computes the length of this object's color vector in RGB space (i.e excluding alpha).
- Returns:
- SI_Float The length of this color in RGB space.
- See also:
- CSIBCColorf::GetLengthAlpha
CSIBCColorf::GetSquaredLength
| SI_Float GetLengthAlpha |
( |
|
) |
const |
Computes the length of this object's color vector in RGBA space (i.e including alpha).
- Returns:
- SI_Float The length of this color in RGBA space.
- See also:
- CSIBCColorf::GetLength
CSIBCColorf::GetSquaredLengthAlpha
| SI_Float GetSquaredLength |
( |
|
) |
const |
Computes the squared length of this object's color vector in RGB space (i.e excluding alpha).
- Returns:
- SI_Float The length of this color in RGB space.
- See also:
- CSIBCColorf::GetLength
CSIBCColorf::GetSquaredLengthAlpha
| SI_Float GetSquaredLengthAlpha |
( |
|
) |
const |
Computes the squared length of this object's color vector in RGBA space (i.e including alpha).
- Returns:
- SI_Float The length of this color in RGBA space.
- See also:
- CSIBCColorf::GetLengthAlpha
CSIBCColorf::GetSquaredLength
| SI_Float GetMaxComponent |
( |
SI_Int * |
i_pIndex |
) |
const |
Gets the value and index largest color component (excluding alpha).
- Parameters:
-
|
|
i_pIndex |
Pointer to a value set to the index of the largest component. (0 = Red, 1 = Green, 2 = Blue). |
- Returns:
- SI_Float Value of the largest color component
- See also:
- CSIBCColorf::GetMaxComponentAlpha
CSIBCColorf::GetMinComponent
| SI_Float GetMaxComponentAlpha |
( |
SI_Int * |
i_pIndex |
) |
const |
Gets the value and index largest color component (including alpha).
- Parameters:
-
|
|
i_pIndex |
Pointer to a value set to the index of the largest component. (0 = Red, 1 = Green, 2 = Blue, 3 = Alpha). |
- Returns:
- SI_Float Value of the largest color component
- See also:
- CSIBCColorf::GetMaxComponent
CSIBCColorf::GetMinComponentAlpha
| SI_Float GetMinComponent |
( |
SI_Int * |
i_pIndex |
) |
const |
Gets the value and index smallest color component (excluding alpha).
- Parameters:
-
|
|
i_pIndex |
Pointer to a value set to the index of the smallest component. (0 = Red, 1 = Green, 2 = Blue). |
- Returns:
- SI_Float Value of the smallest color component
- See also:
- CSIBCColorf::GetMinComponentAlpha
CSIBCColorf::GetMaxComponent
| SI_Float GetMinComponentAlpha |
( |
SI_Int * |
i_pIndex |
) |
const |
Gets the value and index smallest color component (including alpha).
- Parameters:
-
|
|
i_pIndex |
Pointer to a value set to the index of the smallest component. (0 = Red, 1 = Green, 2 = Blue, 3 = Alpha). |
- Returns:
- SI_Float Value of the smallest color component
- See also:
- CSIBCColorf::GetMinComponent
CSIBCColorf::GetMaxComponentAlpha
| void Get |
( |
SI_Float * |
o_pR, |
|
|
|
SI_Float * |
o_pG, |
|
|
|
SI_Float * |
o_pB, |
|
|
|
SI_Float * |
o_pA |
|
|
|
) |
|
|
const |
Gets the value of each color component in this color object (including alpha).
- Parameters:
-
|
|
o_pR |
Pointer to a SI_Float to receive the Red component of this color. |
|
|
o_pG |
Pointer to a SI_Float to receive the Green component of this color. |
|
|
o_pB |
Pointer to a SI_Float to receive the Blue component of this color. |
|
|
o_pA |
Pointer to a SI_Float to receive the Alpha component of this color. |
- See also:
- CSIBCColorf::Set
| void Get |
( |
SI_Float * |
o_pR, |
|
|
|
SI_Float * |
o_pG, |
|
|
|
SI_Float * |
o_pB |
|
|
|
) |
|
|
const |
Gets the value of each color component in this color object (excluding alpha).
- Parameters:
-
|
|
o_pR |
Pointer to a SI_Float to receive the Red component of this color. |
|
|
o_pG |
Pointer to a SI_Float to receive the Green component of this color. |
|
|
o_pB |
Pointer to a SI_Float to receive the Blue component of this color. |
- See also:
- CSIBCColorf::Set
| CSIBCColorf& Set |
( |
SI_Float |
i_fR, |
|
|
|
SI_Float |
i_fG, |
|
|
|
SI_Float |
i_fB, |
|
|
|
SI_Float |
i_fA = 1.0f |
|
|
|
) |
|
|
|
Sets each of the color components of this color object.
- Parameters:
-
|
|
i_fR |
The value to set the Red component to. |
|
|
i_fG |
The value to set the Green component to. |
|
|
i_fB |
The value to set the Blue component to. |
|
|
i_fA |
The value to set the Alpha component to (defaults to 1.0f). |
- Returns:
- CSIBCColorf& Reference to this object.
- See also:
- CSIBCColorf::Get
Normalizes the RGB color vector of this color.
- Returns:
- CSIBCColorf& Reference to this object.
- See also:
- CSIBCColorf::NormalizeAlpha
Normalizes the RGBA color vector of this color.
- Returns:
- CSIBCColorf& Reference to this object.
- See also:
- CSIBCColorf::Normalize
Sets the RGB components of this color to zero, and the alpha to alpha.
- Parameters:
-
|
|
alpha |
Value to set the alpha component of this color to. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::IsNull
CSIBCColorf::IsNullAlpha
Sets the length of the RGB vector (i.e excluding alpha) to in_dLength
- Parameters:
-
|
|
in_dLength |
The new length for the RGB vector. |
- Returns:
- CSIBCColorf& Reference to this object.
- See also:
- CSIBCColorf::SetLengthAlpha
CSIBCColorf::GetLength
CSIBCColorf::GetSquaredLength
Sets the length of the RGBA vector (i.e including alpha) to in_dLength
- Parameters:
-
|
|
in_dLength |
The new length for the RGBA vector. |
- Returns:
- CSIBCColorf& Reference to this object.
- See also:
- CSIBCColorf::SetLength
CSIBCColorf::GetLengthAlpha
CSIBCColorf::GetSquaredLengthAlpha
Negates all color component values (excluding alpha).
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::NegateAlpha
Negates all color component values (including alpha).
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::Negate
Sets the color components of this object to the sum of its components with the components of i_Color (excluding alpha).
- Parameters:
-
|
|
i_Color |
Color object to add color component values from. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::AddAlpha
Sets the color components of this object to the sum of its components with the components of i_Color (including alpha).
- Parameters:
-
|
|
i_Color |
Color object to add color component values from. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::Add
CSIBCColorf::operator+
Sets the color components of this object to the difference of its components with the components of i_Color (excluding alpha).
- Parameters:
-
|
|
i_Color |
Color object to subtract color component values from. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::SubAlpha
Sets the color components of this object to the difference of its components with the components of i_Color (including alpha).
- Parameters:
-
|
|
i_Color |
Color object to subtract color component values from. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::Sub
Scales the color components of this object by i_fFactor (excluding alpha).
- Parameters:
-
|
|
i_fFactor |
Scaling factor to use. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::ScaleAlpha
Scales the color components of this object by i_fFactor (including alpha).
- Parameters:
-
|
|
i_fFactor |
Scaling factor to use. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::Scale
CSIBCColorf::operator*
Sets this object's color component values to the product of its original values, and the component values in i_Color (including alpha).
- Parameters:
-
|
|
i_Color |
The color to multiply component values with. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::DivComp
Sets this object's color component values to the quotient of its original values, divided by the component values in i_Color (including alpha).
- Parameters:
-
|
|
i_Color |
The color to divide component values with. |
- Returns:
- CSIBCColorf& Reference to this object
- See also:
- CSIBCColorf::MulComp
| SI_Bool operator== |
( |
const CSIBCColorf & |
i_Color |
) |
const |
Equality operator. Determines whether each color component of i_Color is exactly equal to the corresponding color component in this color.
- Parameters:
-
|
|
i_Color |
The color to compare equality with. |
- Returns:
- SI_Bool TRUE if the color components in the objects are identical, FALSE otherwise.
- See also:
- CSIBCColorf::IsAlmostEqualTo
| SI_Bool operator!= |
( |
const CSIBCColorf & |
i_Color |
) |
const |
Inequality operator. Determines whether any color component of i_Color are different to the corresponding color component in this color.
- Parameters:
-
|
|
i_Color |
The color to compare inequality with. |
- Returns:
- SI_Bool TRUE if the color components in the objects are not identical, FALSE otherwise.
- See also:
- CSIBCColorf::IsAlmostEqualTo
Addition operator. Computes a color object with the color components of this objects, and i_Color summed.
- Parameters:
-
|
|
i_Color |
The color object to sum components with. |
- Returns:
- CSIBCColorf Color object representing the color obtained by summing this object and
i_Color's color components.
- See also:
- CSIBCColorf::Add
Scaling operator. Computes a color object whose color components are this object's color components multiplied by i_fFactor.
- Parameters:
-
|
|
i_fFactor |
Scaling factor for color components. |
- Returns:
- CSIBCColorf Color object representing this object's scaled color components.
- See also:
- CSIBCColorf::ScaleAlpha
Member Data Documentation
Member variable representing the value of the Red component of the color.
Member variable representing the value of the Green component of the color.
Member variable representing the value of the Blue component of the color.
Member variable representing the value of the Alpha component of the color.
The documentation for this class was generated from the following file: