decColorMatrix Class Reference

5x4 Component Matrix. More...

#include <decColorMatrix.h>

List of all members.

Public Member Functions

Constructors and Destructors
 decColorMatrix ()
 Creates a new color matrix initialized to identity.
Management
void SetIdentity ()
 Sets identity color matrix.
void SetTranslation (float red, float green, float blue, float alpha)
 Sets color translation matrix.
void SetTranslation (const decColor &color)
 Sets color translation matrix.
void SetScaling (float sred, float sgreen, float sblue, float salpha)
 Sets color scaling matrix.
void SetScaling (const decColor &color)
 Sets color scaling matrix.
void SetFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &alpha, const decColor &translation)
 Sets color matrix with the given colors as transformation base.
float Determinant () const
 Calculates the determinant of the color matrix.
decColorMatrix Invert () const
 Retrieves the inverse of this color matrix if the inverse is possible.
decColor GetRedBase () const
 Retrieves the red color base.
decColor GetGreenBase () const
 Retrieves the green color base.
decColor GetBlueBase () const
 Retrieves the blue color base.
decColor GetAlphaBase () const
 Retrieves the alpha color base.
decColor GetTranslationBase () const
 Retrieves the translation color base.
void SetRedBase (const decColor &color)
 Sets the red color base.
void SetGreenBase (const decColor &color)
 Sets the green color base.
void SetBlueBase (const decColor &color)
 Sets the blue color base.
void SetAlphaBase (const decColor &color)
 Sets the alpha color base.
void SetTranslationBase (const decColor &color)
 Sets the translation color base.
decColor Transform (const decColor &color) const
 Transforms color by this matrix.
bool IsEqualTo (const decColorMatrix &matrix, float threshold=0.0001) const
 Determines if this matrix is cell wise equal to another one in respect to a threshold.
Operators
decColorMatrixoperator= (const decColorMatrix &matrix)
 Sets the cells of this matrix to the values of another one.
decColorMatrixoperator+= (const decColorMatrix &matrix)
 Adds the cells of another matrix to this one.
decColorMatrixoperator-= (const decColorMatrix &matrix)
 Subtracts the cells of another matrix from this vector.
decColorMatrixoperator*= (float scalar)
 Multiplies the cells of this matrix with a value k.
decColorMatrixoperator/= (float scalar)
 Divides the cells of this matrix by a value k.
decColorMatrixoperator*= (const decColorMatrix &matrix)
 Multiplies this matrix with another one.
decColorMatrix operator+ (const decColorMatrix &matrix) const
 Retrieves a new matrix with the sum of this matrix with another one.
decColorMatrix operator- (const decColorMatrix &matrix) const
 Retrieves a new matrix with the difference of this matrix to another one.
decColorMatrix operator* (float scalar) const
 Retrieves a new matrix with this matrix scaled by k.
decColorMatrix operator/ (float scalar) const
 Retrieves a new matrix with this matrix divided by k.
decColorMatrix operator* (const decColorMatrix &matrix) const
 Retrieves a new matrix with this matrix multiplied with another one.
decColor operator* (const decColor &color) const
 Transforms color by this matrix.

Static Public Member Functions

Matrix Creation
static decColorMatrix CreateIdentity ()
 Creates a new identity color matrix.
static decColorMatrix CreateTranslation (float red, float green, float blue, float alpha)
 Creates a new color translation matrix.
static decColorMatrix CreateTranslation (const decColor &color)
 Creates a new color translation matrix.
static decColorMatrix CreateScaling (float sred, float sgreen, float sblue, float salpha)
 Creates a new color scaling matrix.
static decColorMatrix CreateScaling (const decColor &color)
 Creates a new color scaling matrix.
static decColorMatrix CreateFrom (const decColor &red, const decColor &green, const decColor &blue, const decColor &alpha, const decColor &translation)
 Creates a color matrix with the given colors as transformation base.

Public Attributes

Cells

The first number indicates the row the second the column.

float a11
float a12
float a13
float a14
float a15
float a21
float a22
float a23
float a24
float a25
float a31
float a32
float a33
float a34
float a35
float a41
float a42
float a43
float a44
float a45

Detailed Description

5x4 Component Matrix.

Provides matrix calculation on a 5x4 matrix in row major order. This kind of matrix is useful for transforming 4 component color values.

Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

decColorMatrix::decColorMatrix (  )

Creates a new color matrix initialized to identity.


Member Function Documentation

static decColorMatrix decColorMatrix::CreateFrom ( const decColor red,
const decColor green,
const decColor blue,
const decColor alpha,
const decColor translation 
) [static]

Creates a color matrix with the given colors as transformation base.

The red color fills the values in the first column, the green of the second, the blue of the third, the alpha of the fourth and the translation the fifth.

static decColorMatrix decColorMatrix::CreateIdentity (  ) [static]

Creates a new identity color matrix.

static decColorMatrix decColorMatrix::CreateScaling ( float  sred,
float  sgreen,
float  sblue,
float  salpha 
) [static]

Creates a new color scaling matrix.

static decColorMatrix decColorMatrix::CreateScaling ( const decColor color ) [static]

Creates a new color scaling matrix.

static decColorMatrix decColorMatrix::CreateTranslation ( float  red,
float  green,
float  blue,
float  alpha 
) [static]

Creates a new color translation matrix.

static decColorMatrix decColorMatrix::CreateTranslation ( const decColor color ) [static]

Creates a new color translation matrix.

float decColorMatrix::Determinant (  ) const

Calculates the determinant of the color matrix.

Mathematically this only works on a 5x5 matrix. Hence the color matrix is first expanded with an identity line at the bottom to become a 5x5 matrix to calculate the determinant from.

decColor decColorMatrix::GetAlphaBase (  ) const [inline]

Retrieves the alpha color base.

References a14, a24, a34, and a44.

decColor decColorMatrix::GetBlueBase (  ) const [inline]

Retrieves the blue color base.

References a13, a23, a33, and a43.

decColor decColorMatrix::GetGreenBase (  ) const [inline]

Retrieves the green color base.

References a12, a22, a32, and a42.

decColor decColorMatrix::GetRedBase (  ) const [inline]

Retrieves the red color base.

References a11, a21, a31, and a41.

decColor decColorMatrix::GetTranslationBase (  ) const [inline]

Retrieves the translation color base.

References a15, a25, a35, and a45.

decColorMatrix decColorMatrix::Invert (  ) const

Retrieves the inverse of this color matrix if the inverse is possible.

Mathematically this only works for a 5x5 matrix. Hence we expand the color matrix with an identity line to become a 5x5 matrix. Thereof the inverse is calculated and only the 5x4 part is returned.

bool decColorMatrix::IsEqualTo ( const decColorMatrix matrix,
float  threshold = 0.0001 
) const

Determines if this matrix is cell wise equal to another one in respect to a threshold.

decColorMatrix decColorMatrix::operator* ( float  scalar ) const

Retrieves a new matrix with this matrix scaled by k.

decColorMatrix decColorMatrix::operator* ( const decColorMatrix matrix ) const

Retrieves a new matrix with this matrix multiplied with another one.

Mathematically this would yield a 5x5 matrix but as a color matrix has no use for the last line only the 5x4 part is returned.

decColor decColorMatrix::operator* ( const decColor color ) const

Transforms color by this matrix.

decColorMatrix& decColorMatrix::operator*= ( const decColorMatrix matrix )

Multiplies this matrix with another one.

Mathematically this would yield a 5x5 matrix but as a color matrix has no use for the last line only the 5x4 part is returned.

decColorMatrix& decColorMatrix::operator*= ( float  scalar )

Multiplies the cells of this matrix with a value k.

decColorMatrix decColorMatrix::operator+ ( const decColorMatrix matrix ) const

Retrieves a new matrix with the sum of this matrix with another one.

decColorMatrix& decColorMatrix::operator+= ( const decColorMatrix matrix )

Adds the cells of another matrix to this one.

decColorMatrix decColorMatrix::operator- ( const decColorMatrix matrix ) const

Retrieves a new matrix with the difference of this matrix to another one.

decColorMatrix& decColorMatrix::operator-= ( const decColorMatrix matrix )

Subtracts the cells of another matrix from this vector.

decColorMatrix decColorMatrix::operator/ ( float  scalar ) const

Retrieves a new matrix with this matrix divided by k.

If k is 0 an exception is thrown.

decColorMatrix& decColorMatrix::operator/= ( float  scalar )

Divides the cells of this matrix by a value k.

If the value k is 0 an exception is thrown.

decColorMatrix& decColorMatrix::operator= ( const decColorMatrix matrix )

Sets the cells of this matrix to the values of another one.

void decColorMatrix::SetAlphaBase ( const decColor color ) [inline]

Sets the alpha color base.

References decColor::a, a14, a24, a34, a44, decColor::b, decColor::g, and decColor::r.

void decColorMatrix::SetBlueBase ( const decColor color ) [inline]

Sets the blue color base.

References decColor::a, a13, a23, a33, a43, decColor::b, decColor::g, and decColor::r.

void decColorMatrix::SetFrom ( const decColor red,
const decColor green,
const decColor blue,
const decColor alpha,
const decColor translation 
)

Sets color matrix with the given colors as transformation base.

The red color fills the values in the first column, the green of the second, the blue of the third, the alpha of the fourth and the translation the fifth.

void decColorMatrix::SetGreenBase ( const decColor color ) [inline]

Sets the green color base.

References decColor::a, a12, a22, a32, a42, decColor::b, decColor::g, and decColor::r.

void decColorMatrix::SetIdentity (  )

Sets identity color matrix.

void decColorMatrix::SetRedBase ( const decColor color ) [inline]

Sets the red color base.

References decColor::a, a11, a21, a31, a41, decColor::b, decColor::g, and decColor::r.

void decColorMatrix::SetScaling ( const decColor color )

Sets color scaling matrix.

void decColorMatrix::SetScaling ( float  sred,
float  sgreen,
float  sblue,
float  salpha 
)

Sets color scaling matrix.

void decColorMatrix::SetTranslation ( float  red,
float  green,
float  blue,
float  alpha 
)

Sets color translation matrix.

void decColorMatrix::SetTranslation ( const decColor color )

Sets color translation matrix.

void decColorMatrix::SetTranslationBase ( const decColor color ) [inline]

Sets the translation color base.

References decColor::a, a15, a25, a35, a45, decColor::b, decColor::g, and decColor::r.

decColor decColorMatrix::Transform ( const decColor color ) const

Transforms color by this matrix.


Member Data Documentation

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetAlphaBase(), and SetAlphaBase().

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetAlphaBase(), and SetAlphaBase().

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetAlphaBase(), and SetAlphaBase().

Referenced by GetRedBase(), and SetRedBase().

Referenced by GetGreenBase(), and SetGreenBase().

Referenced by GetBlueBase(), and SetBlueBase().

Referenced by GetAlphaBase(), and SetAlphaBase().


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