InstantIO::ColorRGBA Class Reference

Helper class for exchanging RGBA colors of three float components. More...

#include <InstantIO/ColorRGBA.h>

List of all members.

Public Member Functions

 ColorRGBA ()
 Constructor that initializes all components of the color with 0.
 ColorRGBA (float r, float g, float b, float a)
 Constructor that initializes the components of the color with the given float values.
 ColorRGBA (const float *color)
 Constructor that initializes the components of the color with the values of a given float array.
 ColorRGBA (const ColorRGBA &color)
 Constructor that initializes the components of the color with the components taken from another color.
const ColorRGBAoperator= (const ColorRGBA &color)
 Assigns the components of another ColorRGBA object to this object's components.
const float * operator= (const float *color)
 Assigns an array of floats to this object's components.
void setR (float r)
 Sets the value of the r component.
float getR () const
 Returns the value of the r component.
void setG (float g)
 Sets the value of the g component.
float getG () const
 Returns the value of the g component.
void setB (float b)
 Sets the value of the b component.
float getB () const
 Returns the value of the b component.
void setA (float a)
 Sets the value of the a component.
float getA () const
 Returns the value of the a component.
void set (float r, float g, float b, float a)
 Sets the values of the r, g and b components.
void set (const float *color)
 Sets the values of the r, g and b components.
void set (const ColorRGBA &color)
 Sets the values of the r, g and b components.
void get (float &r, float &g, float &b, float &a) const
 Returns the values of the r, b and g components.
void get (float *color) const
 Returns the values of the r, g and b components.
void get (ColorRGBA &color) const
 Returns the values of the r, g and b components.
const float * get () const
 Returns the values of the r, g and b components.
float * get ()
 Returns the values of the r, g and b components.
float operator[] (int i) const
 Returns a component of the color specified by an index.
float & operator[] (int i)
 Returns a component of the color specified by an index.
 operator float * ()
 Converts the ColorRGBA object to an array of floats.
 operator const float * () const
 Converts the ColorRGBA object to an array of floats.

Friends

bool operator== (const ColorRGBA &a, const ColorRGBA &b)
 Checks if all components of two colors are the same.
bool operator!= (const ColorRGBA &a, const ColorRGBA &b)
 Checks if two colors differ at least in one component.

Detailed Description

Helper class for exchanging RGBA colors of three float components.

ColorRGBA is a basic helper class for exchanging colors of three float components between different software components. It does not contain any means for color arithmetics, only methods for setting and getting the components. It is not meant to be used directly by software components for color representation. Instead, software components should use their own, appropriate classes for handling colors. Only when sending colors to an OutSlot, or when receiving colors from an InSlot, the internal representation of colors should be converted to ColorRGBA's. This ensures the interoperability between different software components that use different internal representations for colors.

Author:
Helmut Seibert

Constructor & Destructor Documentation

InstantIO::ColorRGBA::ColorRGBA ( float  r,
float  g,
float  b,
float  a 
) [inline]

Constructor that initializes the components of the color with the given float values.

Parameters:
r Value of the r component of the new color.
g Value of the g component of the new color.
b Value of the b component of the new color.
a Value of the a component of the new color.
InstantIO::ColorRGBA::ColorRGBA ( const float *  color  )  [inline]

Constructor that initializes the components of the color with the values of a given float array.

Parameters:
vec An array of at least three float values. The r component of the color is set to the value of the first element of the array, the g component is set to the value of the second element of the array, the b component is set to the value of the third element of the array and the a component is set to the value of the fourth element of the array.
InstantIO::ColorRGBA::ColorRGBA ( const ColorRGBA color  )  [inline]

Constructor that initializes the components of the color with the components taken from another color.

Parameters:
vec The other color used to initialize the new color.

Member Function Documentation

const ColorRGBA& InstantIO::ColorRGBA::operator= ( const ColorRGBA color  )  [inline]

Assigns the components of another ColorRGBA object to this object's components.

Parameters:
vec The other ColorRGBA object
Returns:
The other ColorRGBA object
const float* InstantIO::ColorRGBA::operator= ( const float *  color  )  [inline]

Assigns an array of floats to this object's components.

Parameters:
vec An array of at least three float values. The r component of the color is set to the value of the first element of the array, the g component is set to the value of the second element of the array, the g component is set to the value of the third element of the array, and the a component is set to the value of the fourth element of the array.
Returns:
The array of floats
void InstantIO::ColorRGBA::setR ( float  r  )  [inline]

Sets the value of the r component.

Parameters:
r The new value of the r component
float InstantIO::ColorRGBA::getR (  )  const [inline]

Returns the value of the r component.

Returns:
The value of the r component
void InstantIO::ColorRGBA::setG ( float  g  )  [inline]

Sets the value of the g component.

Parameters:
g The new value of the g component
float InstantIO::ColorRGBA::getG (  )  const [inline]

Returns the value of the g component.

Returns:
The value of the g component
void InstantIO::ColorRGBA::setB ( float  b  )  [inline]

Sets the value of the b component.

Parameters:
b The new value of the b component
float InstantIO::ColorRGBA::getB (  )  const [inline]

Returns the value of the b component.

Returns:
The value of the b component
void InstantIO::ColorRGBA::setA ( float  a  )  [inline]

Sets the value of the a component.

Parameters:
a The new value of the a component
float InstantIO::ColorRGBA::getA (  )  const [inline]

Returns the value of the a component.

Returns:
The value of the a component
void InstantIO::ColorRGBA::set ( float  r,
float  g,
float  b,
float  a 
) [inline]

Sets the values of the r, g and b components.

Parameters:
r The new value of the r component
g The new value of the g component
b The new value of the b component
a The new value of the a component
void InstantIO::ColorRGBA::set ( const float *  color  )  [inline]

Sets the values of the r, g and b components.

Parameters:
vec An array of at least three float values. The r component of the color is set to the value of the first element of the array, the g component is set to the value of the second element of the array, and the b component is set to the value of the third element of the array.
void InstantIO::ColorRGBA::set ( const ColorRGBA color  )  [inline]

Sets the values of the r, g and b components.

Parameters:
vec The other color used to set the components of this color.
void InstantIO::ColorRGBA::get ( float &  r,
float &  g,
float &  b,
float &  a 
) const [inline]

Returns the values of the r, b and g components.

Parameters:
x Returns the r component of the color
y Returns the g component of the color
z Returns the b component of the color
void InstantIO::ColorRGBA::get ( float *  color  )  const [inline]

Returns the values of the r, g and b components.

Parameters:
vec A float array that gets filled with the components of the color. This array must have at least three elements. The first element of the array is set to the r component of the color, the second element of the array is set to the g component of the color, and the third element of the array is set to the b component of the color.
void InstantIO::ColorRGBA::get ( ColorRGBA color  )  const [inline]

Returns the values of the r, g and b components.

Parameters:
vec The other color whose components are set to components of this color.
const float* InstantIO::ColorRGBA::get (  )  const [inline]

Returns the values of the r, g and b components.

Returns:
An array of three float elements. The first element of the array is the r component of the color, the second element of the array is the g component of the color, and the third element of the array is the b component of the color.
float* InstantIO::ColorRGBA::get (  )  [inline]

Returns the values of the r, g and b components.

Returns:
An array of three float elements. The first element of the array is the r component of the color, the second element of the array is the g component of the color, and the third element of the array is the b component of the color.
float InstantIO::ColorRGBA::operator[] ( int  i  )  const [inline]

Returns a component of the color specified by an index.

Parameters:
i The index of the component (must be 0, 1 or 2)
Returns:
The component
float& InstantIO::ColorRGBA::operator[] ( int  i  )  [inline]

Returns a component of the color specified by an index.

Parameters:
i The index of the component (must be 0, 1 or 2)
Returns:
The component
InstantIO::ColorRGBA::operator float * (  )  [inline]

Converts the ColorRGBA object to an array of floats.

Returns:
Array of floats
InstantIO::ColorRGBA::operator const float * (  )  const [inline]

Converts the ColorRGBA object to an array of floats.

Returns:
Array of floats

Friends And Related Function Documentation

bool operator== ( const ColorRGBA a,
const ColorRGBA b 
) [friend]

Checks if all components of two colors are the same.

Parameters:
a The first color
b The second color
Returns:
true when all components are the same, false otherwise
bool operator!= ( const ColorRGBA a,
const ColorRGBA b 
) [friend]

Checks if two colors differ at least in one component.

Parameters:
a The first color
b The second color
Returns:
true when the two colors differ at least in one component, false otherwise

The documentation for this class was generated from the following file:
Generated on Thu Jul 31 17:17:32 2014 by  doxygen 1.6.3