# CColor4f Class Reference

A color class represented by single floating values. CColor4f supports the RGBA, HSVA and HLSA color models. More...

`#include <xsi_color4f.h>`

List of all members.

## Public Types
enum | Type
## Public Member Functions
__forceinline | CColor4f (float in_R=0, float in_G=0, float in_B=0, float in_A=0)
__forceinline | CColor4f (float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType)
__forceinline | CColor4f (const CColor4f &in_color)
| ~CColor4f ()
__forceinline void | Set (float in_R, float in_G, float in_B, float in_A)
__forceinline void | Set (float in_Arg1, float in_Arg2, float in_Arg3, float in_A, Type in_eColorType)
__forceinline float & | PutR (const float in_R)
__forceinline float & | PutG (const float in_G)
__forceinline float & | PutB (const float in_B)
__forceinline float & | PutA (const float in_A)
__forceinline void | GetAsRGBA (float &out_R, float &out_G, float &out_B, float &out_A) const
__forceinline void | GetAsHLSA (float &out_H, float &out_L, float &out_S, float &out_A) const
__forceinline void | GetAsHSVA (float &out_H, float &out_S, float &out_V, float &out_A) const
__forceinline float | GetH () const
__forceinline float | GetL () const
__forceinline float | GetS_HSVA () const
__forceinline float | GetS_HLSA () const
__forceinline float | GetV () const
__forceinline float & | GetR ()
__forceinline float & | GetG ()
__forceinline float & | GetB ()
__forceinline float & | GetA ()
__forceinline float * | GetRGBA ()
__forceinline const float & | GetR () const
__forceinline const float & | GetG () const
__forceinline const float & | GetB () const
__forceinline const float & | GetA () const
__forceinline const float * | GetRGBA () const
__forceinline | operator float * ()
__forceinline bool | operator== (const CColor4f &in_rColor4f) const
__forceinline bool | operator!= (const CColor4f &in_rColor4f) const
__forceinline bool | operator< (const CColor4f &in_rColor4f) const
__forceinline bool | IsNull (float in_fEpsilon) const
__forceinline CColor4f & | Add (const CColor4f &in_col)
__forceinline CColor4f & | Mul (float in_fFactor)
__forceinline CColor4f & | Mul (const CColor4f &in_col)
__forceinline CColor4f & | Sub (const CColor4f &in_col)
__forceinline CColor4f & | Negate ()
__forceinline void | PutNull ()
__forceinline float | GetBrightness () const
__forceinline float | GetBrightnessWithAlpha () const
__forceinline float | GetGrayscale () const
__forceinline float | GetGrayscaleWithAlpha () const
__forceinline CColor4f & | InverseRGB ()

## Detailed Description

A color class represented by single floating values. CColor4f supports the RGBA, HSVA and HLSA color models.

## Member Enumeration Documentation

enum Type

Defines the color model types supported.

## Constructor & Destructor Documentation

__forceinline CColor4f | ( | float | in_R = `0`,
|  | float | in_G = `0`,
|  | float | in_B = `0`,
|  | float | in_A = `0` |
| ) |  |  |

Constructor.

Parameters:

  | in_R | Red component
  | in_G | Green component
  | in_B | Blue component
  | in_A | Alpha component

__forceinline CColor4f | ( | float | in_Arg1,
|  | float | in_Arg2,
|  | float | in_Arg3,
|  | float | in_A,
|  | Type | in_eColorType |
| ) |  |  |

Constructor. Creates a new object of a specific color type .

Parameters:

  | in_Arg1 | Component 1
  | in_Arg2 | Component 2
  | in_Arg3 | Component 3
  | in_A | Alpha component
  | in_eColorType | Color type

__forceinline CColor4f | ( | const CColor4f & | in_color | ) |

Copy constructor. Cretaes a new object as a RGBA type.

Parameters:

  | in_color | CColor4f object.

~CColor4f | ( |  | ) | `[inline]`

Destructor.

## Member Function Documentation

__forceinline void Set | ( | float | in_R,
|  | float | in_G,
|  | float | in_B,
|  | float | in_A |
| ) |  |  |

Set the object with new values.

Parameters:

  | in_R | Red component
  | in_G | Green component
  | in_B | Blue component
  | in_A | Alpha component

__forceinline void Set | ( | float | in_Arg1,
|  | float | in_Arg2,
|  | float | in_Arg3,
|  | float | in_A,
|  | Type | in_eColorType |
| ) |  |  |

Set the object with new values for a specific type.

Parameters:

  | in_Arg1 | Component 1
  | in_Arg2 | Component 2
  | in_Arg3 | Component 3
  | in_A | Alpha component
  | in_eColorType | Color type

__forceinline float & PutR | ( | const float | in_R | ) |

Set the object's red component.

Parameters:

  | in_R | value

Returns:
  Reference to new value

__forceinline float & PutG | ( | const float | in_G | ) |

Set the object's green component.

Parameters:

  | in_G | value

Returns:
  Reference to new value

__forceinline float & PutB | ( | const float | in_B | ) |

Set the object's blue component.

Parameters:

  | in_B | value

Returns:
  Reference to new value

__forceinline float & PutA | ( | const float | in_A | ) |

Set the object's alpha component.

Parameters:

  | in_A | value

Returns:
  Reference to new value

__forceinline void GetAsRGBA | ( | float & | out_R,
|  | float & | out_G,
|  | float & | out_B,
|  | float & | out_A |
| ) |  |  | const

Returns the object's RGBA values.

Return values:

  | out_R | Red component
  | out_G | Green component
  | out_B | Blue component
  | out_A | Alpha component

__forceinline void GetAsHLSA | ( | float & | out_H,
|  | float & | out_L,
|  | float & | out_S,
|  | float & | out_A |
| ) |  |  | const

Returns the object's HLSA values.

Return values:

  | out_H | Hue component
  | out_L | Luminance component
  | out_S | Saturation component
  | out_A | Alpha component

__forceinline void GetAsHSVA | ( | float & | out_H,
|  | float & | out_S,
|  | float & | out_V,
|  | float & | out_A |
| ) |  |  | const

Returns the object's HSVA values.

Return values:

  | out_H | Hue component
  | out_S | Saturation component
  | out_V | Value component
  | out_A | Alpha component

__forceinline float GetH | ( |  | ) | const

Return the object's hue component.

Returns:
  Component value.

__forceinline float GetL | ( |  | ) | const

Return the object's luminence component.

Returns:
  Component value.

__forceinline float GetS_HSVA | ( |  | ) | const

Return the object's saturation component from the HSVA color space.

Returns:
  Component value.

__forceinline float GetS_HLSA | ( |  | ) | const

Return the object's saturation component from the HLSA color space.

Returns:
  Component value.

__forceinline float GetV | ( |  | ) | const

Return the object's value component.

Returns:
  Component value.

__forceinline float & GetR | ( |  | ) |

Return the object's red component.

Returns:
  Component value.

__forceinline float & GetG | ( |  | ) |

Return the object's green component.

Returns:
  Component value.

__forceinline float & GetB | ( |  | ) |

Return the object's blue component.

Returns:
  Component value.

__forceinline float & GetA | ( |  | ) |

Return the object's alpha component.

Returns:
  Component value.

__forceinline float * GetRGBA | ( |  | ) |

Return a pointer to the color component array.

Returns:
  Component array.

__forceinline const float & GetR | ( |  | ) | const

Return a reference on the object's red component.

Returns:
  Reference to component value.

__forceinline const float & GetG | ( |  | ) | const

Return a reference on the object's green component.

Returns:
  Reference to component value.

__forceinline const float & GetB | ( |  | ) | const

Return a reference on the object's blue component.

Returns:
  Reference to component value.

__forceinline const float & GetA | ( |  | ) | const

Return a reference on the object's alpha component.

Returns:
  Reference to component value.

__forceinline const float * GetRGBA | ( |  | ) | const

Return a read-only pointer the color component array.

Returns:
  Pointer to component array.

__forceinline operator float * | ( |  | ) |

float cast operator which returns a pointer to the color component array.

Returns:
  Pointer to component array.

__forceinline bool operator== | ( | const CColor4f & | in_rColor4f | ) | const

Performs exact comparison of two colors.

Parameters:

  | in_rColor4f | Color to compare against

__forceinline bool operator!= | ( | const CColor4f & | in_rColor4f | ) | const

Inequality operator tests the strict inequality of this color with in_rColor4f.

Parameters:

  | in_rColor4f | Color to test against.

__forceinline bool operator< | ( | const CColor4f & | in_rColor4f | ) | const

Less than operator. Performs a comparison with a specified CColor4f to determine if this CColor4f is less than the specified CColor4f. The comparison is arbitrary and not geometrically meaningful, it's only purpose is to make CColor4f compliant with stl for sorting operations.

Parameters:

  | in_rColor4f | CColor4f to compare.

Returns:
  true if this CColor4f is less than the specified CColor4f, false otherwise.

Since:
  7.5

__forceinline bool IsNull | ( | float | in_fEpsilon | ) | const

Returns true if all component are less than a specific tolerance value.

Parameters:

  | in_fEpsilon | Tolerance to test against

Returns:
  True is the color is null, false otherwise.

__forceinline CColor4f & Add | ( | const CColor4f & | in_col | ) |

Adds input color values to this object.

Parameters:

  | in_col | Color to add.

Returns:
  A reference to this color.

__forceinline CColor4f & Mul | ( | float | in_fFactor | ) |

Scales this color with a factor value.

Parameters:

  | in_fFactor | Multiply factor.

Returns:
  A reference to this color.

__forceinline CColor4f & Mul | ( | const CColor4f & | in_col | ) |

Multiplies this color with an input color (this.R *= c.R, this.G *= c.G, etc...)

Parameters:

  | in_col | Color operand.

Returns:
  A reference to this color.

__forceinline CColor4f & Sub | ( | const CColor4f & | in_col | ) |

Subtracts the input color from this one.

Parameters:

  | in_col | Multiply factor.

Returns:
  A reference to this color.

__forceinline CColor4f & Negate | ( |  | ) |

Negates this color (this = - this).

Returns:
  A reference to this color.

__forceinline void PutNull | ( |  | ) |

Sets all color components to 0.

Returns:
  A reference to this color.

__forceinline float GetBrightness | ( |  | ) | const

Returns the brightness value.

Returns:
  Float value.

__forceinline float GetBrightnessWithAlpha | ( |  | ) | const

Returns the brightness value multiplied with the alpha component.

Returns:
  Float value.

__forceinline float GetGrayscale | ( |  | ) | const

Returns the grayscale value.

Returns:
  Float value.

__forceinline float GetGrayscaleWithAlpha | ( |  | ) | const

Returns the grayscale value multiplied with the alpha component.

Returns:
  Float value.

__forceinline CColor4f & InverseRGB | ( |  | ) |

Inverts the component values for this color.

Returns:
  A reference to this color.

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

- xsi_color4f.h