CSIBCColorb Class Reference



Your Ad Here

Class representing RGBA colours. More...

#include <SIBCColor.h>

List of all members.

Public Member Functions

  CSIBCColorb ()
  CSIBCColorb (const CSIBCColorb &i_Color)
  CSIBCColorb (const SI_UByte i_bR, const SI_UByte i_bG, const SI_UByte i_bB, const SI_UByte i_bA=0)
SI_Bool  IsNull () const
SI_Bool  IsNullAlpha () const
SI_UByte  GetDot (const CSIBCColorb &) const
SI_UByte  GetDotAlpha (const CSIBCColorb &) const
SI_Float  GetDistanceFrom (const CSIBCColorb &) const
SI_Float  GetDistanceFromAlpha (const CSIBCColorb &) const
SI_Float  GetLength () const
SI_Float  GetLengthAlpha () const
SI_Float  GetSquaredLength () const
SI_Float  GetSquaredLengthAlpha () const
SI_UByte  GetMaxComponent (SI_Int *i_pIndex) const
SI_UByte  GetMaxComponentAlpha (SI_Int *i_pIndex) const
SI_UByte  GetMinComponent (SI_Int *i_pIndex) const
SI_UByte  GetMinComponentAlpha (SI_Int *i_pIndex) const
void  Get (SI_UByte *o_pR, SI_UByte *o_pG, SI_UByte *o_pB, SI_UByte *o_pA) const
void  Get (SI_UByte *o_pR, SI_UByte *o_pG, SI_UByte *o_pB) const
CSIBCColorb Set (SI_UByte i_bR, SI_UByte i_bG, SI_UByte i_bB, SI_UByte i_bA=255)
CSIBCColorb Normalize ()
CSIBCColorb NormalizeAlpha ()
CSIBCColorb SetNull (SI_UByte alpha=0)
CSIBCColorb SetLength (const SI_Float in_dLength)
CSIBCColorb SetLengthAlpha (const SI_Float in_dLength)
CSIBCColorb Negate ()
CSIBCColorb NegateAlpha ()
CSIBCColorb Add (const CSIBCColorb &i_Color)
CSIBCColorb AddAlpha (const CSIBCColorb &i_Color)
CSIBCColorb Sub (const CSIBCColorb &i_Color)
CSIBCColorb SubAlpha (const CSIBCColorb &i_Color)
CSIBCColorb Scale (const SI_Float i_fFactor)
CSIBCColorb ScaleAlpha (const SI_Float i_fFactor)
CSIBCColorb MulComp (const CSIBCColorb &i_Color)
CSIBCColorb DivComp (const CSIBCColorb &i_Color)
SI_Bool  operator== (const CSIBCColorb &i_Color) const
SI_Bool  operator!= (const CSIBCColorb &i_Color) const
CSIBCColorb  operator+ (const CSIBCColorb &i_Color)

Public Attributes

SI_UByte  m_fR
SI_UByte  m_fG
SI_UByte  m_fB
SI_UByte  m_fA


Detailed Description

Class representing RGBA colours.

Represents colours and stores RGBA values as unsigned byte 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 CSIBCColorf class, which uses floating-point numbers to represent color components, instead of unsigned bytes.


Constructor & Destructor Documentation

CSIBCColorb (  ) 

Default constructor. Creates a new color object, with uninitialized color values.

CSIBCColorb ( const CSIBCColorb i_Color  ) 

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.

CSIBCColorb ( const SI_UByte  i_bR,
const SI_UByte  i_bG,
const SI_UByte  i_bB,
const SI_UByte  i_bA = 0  
)

Constructor. Creates a new color with the given color component values.

Parameters:
i_bR  Value to set the red component of the color to.
i_bB  Value to set the blue component of the color to.
i_bG  Value to set the green component of the color to.
i_bA  Value to set the alpha component of the color to (defaults to 0).


Member Function Documentation

SI_Bool IsNull (  )  const

Determines whether all component values (excluding alpha) of this color are zero.

Returns:
SI_Bool TRUE if all component values are equal to zero, FALSE otherwise.
See also:
CSIBCColorb::IsNullAlpha

CSIBCColorb::SetNull

SI_Bool IsNullAlpha (  )  const

Determines whether all component values (including alpha) of this color are zero.

Returns:
SI_Bool TRUE if all component values are equal to zero, FALSE otherwise.
See also:
CSIBCColorb::IsNull

CSIBCColorb::SetNull

SI_UByte GetDot ( const CSIBCColorb  )  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 (excluding alpha).

Parameters:
i_Color  Color object to get this object's dot product with.
Returns:
SI_UByte Dot product of the two colors.
See also:
CSIBCColorb::GetDotAlpha

SI_UByte GetDotAlpha ( const CSIBCColorb  )  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_UByte Dot product of the two colors.
See also:
CSIBCColorb::GetDot

SI_Float GetDistanceFrom ( const CSIBCColorb  )  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:
CSIBCColorb::GetDistanceFromAlpha

SI_Float GetDistanceFromAlpha ( const CSIBCColorb  )  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:
CSIBCColorb::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:
CSIBCColorb::GetLengthAlpha

CSIBCColorb::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:
CSIBCColorb::GetLength

CSIBCColorb::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:
CSIBCColorb::GetLength

CSIBCColorb::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:
CSIBCColorb::GetLengthAlpha

CSIBCColorb::GetSquaredLength

SI_UByte 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_UByte Value of the largest color component
See also:
CSIBCColorb::GetMaxComponentAlpha

CSIBCColorb::GetMinComponent

SI_UByte 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_UByte Value of the largest color component
See also:
CSIBCColorb::GetMaxComponent

CSIBCColorb::GetMinComponentAlpha

SI_UByte 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_UByte Value of the smallest color component
See also:
CSIBCColorb::GetMinComponentAlpha

CSIBCColorb::GetMaxComponent

SI_UByte 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_UByte Value of the smallest color component
See also:
CSIBCColorb::GetMinComponent

CSIBCColorb::GetMaxComponentAlpha

void Get ( SI_UByte *  o_pR,
SI_UByte *  o_pG,
SI_UByte *  o_pB,
SI_UByte *  o_pA  
) const

Gets the value of each color component in this color object (including alpha).

Parameters:
o_pR  Pointer to a SI_UByte to receive the Red component of this color.
o_pG  Pointer to a SI_UByte to receive the Green component of this color.
o_pB  Pointer to a SI_UByte to receive the Blue component of this color.
o_pA  Pointer to a SI_UByte to receive the Alpha component of this color.
See also:
CSIBCColorb::Set

void Get ( SI_UByte *  o_pR,
SI_UByte *  o_pG,
SI_UByte *  o_pB  
) const

Gets the value of each color component in this color object (excluding alpha).

Parameters:
o_pR  Pointer to a SI_UByte to receive the Red component of this color.
o_pG  Pointer to a SI_UByte to receive the Green component of this color.
o_pB  Pointer to a SI_UByte to receive the Blue component of this color.
See also:
CSIBCColorb::Set

CSIBCColorb& Set ( SI_UByte  i_bR,
SI_UByte  i_bG,
SI_UByte  i_bB,
SI_UByte  i_bA = 255  
)

Sets each of the color components of this color object.

Parameters:
i_bR  The value to set the Red component to.
i_bG  The value to set the Green component to.
i_bB  The value to set the Blue component to.
i_bA  The value to set the Alpha component to (defaults to 255).
Returns:
CSIBCColorb& Reference to this object.
See also:
CSIBCColorb::Get

CSIBCColorb& Normalize (  ) 

Normalizes the RGB color vector of this color.

Returns:
CSIBCColorb& Reference to this object.
See also:
CSIBCColorb::NormalizeAlpha

CSIBCColorb& NormalizeAlpha (  ) 

Normalizes the RGBA color vector of this color.

Returns:
CSIBCColorb& Reference to this object.
See also:
CSIBCColorb::Normalize

CSIBCColorb& SetNull ( SI_UByte  alpha = 0  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::IsNull

CSIBCColorb::IsNullAlpha

CSIBCColorb& SetLength ( const SI_Float  in_dLength  ) 

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:
CSIBCColorb& Reference to this object.
See also:
CSIBCColorb::SetLengthAlpha

CSIBCColorb::GetLength

CSIBCColorb::GetSquaredLength

CSIBCColorb& SetLengthAlpha ( const SI_Float  in_dLength  ) 

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:
CSIBCColorb& Reference to this object.
See also:
CSIBCColorb::SetLength

CSIBCColorb::GetLengthAlpha

CSIBCColorb::GetSquaredLengthAlpha

CSIBCColorb& Negate (  ) 

Negates all color component values (excluding alpha).

Returns:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::NegateAlpha

CSIBCColorb& NegateAlpha (  ) 

Negates all color component values (including alpha).

Returns:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::Negate

CSIBCColorb& Add ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::AddAlpha

CSIBCColorb& AddAlpha ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::Add

CSIBCColorb::operator+

CSIBCColorb& Sub ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::SubAlpha

CSIBCColorb& SubAlpha ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::Sub

CSIBCColorb& Scale ( const SI_Float  i_fFactor  ) 

Scales the color components of this object by i_fFactor (excluding alpha).

Parameters:
i_fFactor  Scaling factor to use.
Returns:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::ScaleAlpha

CSIBCColorb& ScaleAlpha ( const SI_Float  i_fFactor  ) 

Scales the color components of this object by i_fFactor (including alpha).

Parameters:
i_fFactor  Scaling factor to use.
Returns:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::Scale

CSIBCColorb::operator*

CSIBCColorb& MulComp ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::DivComp

CSIBCColorb& DivComp ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb& Reference to this object
See also:
CSIBCColorb::MulComp

SI_Bool operator== ( const CSIBCColorb i_Color  )  const

Equality operator. Determines whether each color component of i_Color is 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.

SI_Bool operator!= ( const CSIBCColorb 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.

CSIBCColorb operator+ ( const CSIBCColorb i_Color  ) 

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:
CSIBCColorb Color object representing the color obtained by summing this object and i_Color's color components.
See also:
CSIBCColorb::Add


Member Data Documentation

SI_UByte m_fR

Member variable representing the value of the Red component of the color.

SI_UByte m_fG

Member variable representing the value of the Green component of the color.

SI_UByte m_fB

Member variable representing the value of the Blue component of the color.

SI_UByte m_fA

Member variable representing the value of the Alpha component of the color.


The documentation for this class was generated from the following file:

Return to Softimage XSI Index


Your Ad Here