TMCGradient Class Reference
[MCCore]

List of all members.

Public Member Functions

 TMCGradient (void)
 TMCGradient (boolean isEmpty)
 TMCGradient (const TMCClassArray< TMCColorRGBAIndex > &colorArray)
void GetColor (real32 pos, TMCColorRGBA &color) const
int32 GetColorKeyCount () const
void GetColorKey (const int32 elem, TMCColorRGBAIndex &colorKey) const
int32 FindColorKey (const TMCColorRGBAIndex &colorKey, const real32 epsilon) const
int32 FindColorKeyByIndex (const real32 index, const real32 epsilon) const
void SetColorKeyColor (const int32 elem, TMCColorRGBA &color)
void SetColorKeyIndex (const int32 elem, const real32 index)
int32 AddColorKey (TMCColorRGBAIndex &colorIndex)
int32 AddColorKey (TMCColorRGBA &color, real32 index)
int32 AddColorKey (real32 red, real32 green, real32 blue, real32 alpha, real32 index)
boolean RemoveColorKey (const int32 elem)
boolean IsEqual (const TMCGradient &grad, const real32 epsilon=0.0f) const
void Interpolate (const TMCGradient &from, const TMCGradient &to, const real32 interpolant)
void Interpolate (const TVector2 &interpolants, const TMCGradient &lowerLeft, const TMCGradient &lowerRight, const TMCGradient &upperLeft, const TMCGradient &upperRight)
boolean operator== (const TMCGradient &rhs) const
boolean operator!= (const TMCGradient &rhs) const
TMCGradientoperator= (const TMCGradient &grad)
TMCGradientoperator= (const int32 i)

Protected Attributes

TMCClassArray< TMCColorRGBAIndexfColorIndexArray

Detailed Description

A gradient contains an array of TMCColorRGBAIndex (color keys). For a value beetween 0 and 1, it can return an interpolation beetween the 2 colors whose index framed the value. It can be use as a pMap parameter and be animated. kGradientParamType is its paramType value. kGradientValueType is its valueType value.


Constructor & Destructor Documentation

TMCGradient::TMCGradient ( void   )  [inline]
TMCGradient::TMCGradient ( boolean  isEmpty  )  [inline]
TMCGradient::TMCGradient ( const TMCClassArray< TMCColorRGBAIndex > &  colorArray  )  [inline]

Member Function Documentation

int32 TMCGradient::AddColorKey ( real32  red,
real32  green,
real32  blue,
real32  alpha,
real32  index 
)

Adds a new colorKey to the array of keys

Parameters:
red the red part of the colorKey to be added
green the green part of the colorKey to be added
blue the blue part of the colorKey to be added
alpha the alpha part of the colorKey to be added
index the index of the colorKey
int32 TMCGradient::AddColorKey ( TMCColorRGBA color,
real32  index 
)

Adds a new colorKey to the array of keys

Parameters:
color the colorKey to be added
index the index of the colorKey
int32 TMCGradient::AddColorKey ( TMCColorRGBAIndex colorIndex  ) 

Adds a new colorKey to the array of keys

Parameters:
colorIndex the colorKey to be added
Returns:
the position in the array, or -1 if the colorKey couldn't be added.
int32 TMCGradient::FindColorKey ( const TMCColorRGBAIndex colorKey,
const real32  epsilon 
) const

Looks for a specific colorKey in the array of keys. If several are found in the tolerance (epsilon), the nearest one is choosen.

Parameters:
colorKey the TMCColorRGBAIndex to be found in the array.
epsilon a tolerance.
Returns:
the position of the elem in array, -1 if not found.
int32 TMCGradient::FindColorKeyByIndex ( const real32  index,
const real32  epsilon 
) const

Look for a colorKey with the same index in the array of keys. If several are found in the tolerance (epsilon), the nearest one is choosen.

Parameters:
index the index to be found.
epsilon a tolerance.
Returns:
the position of the colorKey in the array, or -1 if none is found.
void TMCGradient::GetColor ( real32  pos,
TMCColorRGBA color 
) const

Get a color in the gradient. Position must be beetween 0 and 1.

Parameters:
pos the position asked
color the color to be filled
void TMCGradient::GetColorKey ( const int32  elem,
TMCColorRGBAIndex colorKey 
) const [inline]

Color keys accessor

Parameters:
elem the index in the array
colorKey the TMCColorRGBAIndex to be returned
int32 TMCGradient::GetColorKeyCount (  )  const [inline]
Returns:
the number of colorKeys
void TMCGradient::Interpolate ( const TVector2 interpolants,
const TMCGradient lowerLeft,
const TMCGradient lowerRight,
const TMCGradient upperLeft,
const TMCGradient upperRight 
)

Bilinear interpolation: set this gradient to a value beetween the 4 gradients

Parameters:
interpolants interpolation values ( x [left/right], y [lower/upper])
lowerLeft,lowerRight,upperLeft,upperRight,: the 4 gradients
void TMCGradient::Interpolate ( const TMCGradient from,
const TMCGradient to,
const real32  interpolant 
)

Linear interpolation: set this gradient to a value beetween the from and to gradients

Parameters:
from first gradient.
to second gradient.
interpolant interpolation value (should be beetween 0 and 1).
boolean TMCGradient::IsEqual ( const TMCGradient grad,
const real32  epsilon = 0.0f 
) const

Equality test beetween this gradient and another one

Parameters:
grad the other gradient
epsilon a tolerance value
Returns:
true if equal ( same number of colorKey, and each colorKey with same color and same index )
boolean TMCGradient::operator!= ( const TMCGradient rhs  )  const [inline]
See also:
!IsEqual()
TMCGradient& TMCGradient::operator= ( const int32  i  )  [inline]
TMCGradient & TMCGradient::operator= ( const TMCGradient grad  )  [inline]
boolean TMCGradient::operator== ( const TMCGradient rhs  )  const [inline]
See also:
IsEqual()
boolean TMCGradient::RemoveColorKey ( const int32  elem  ) 

Removes a colorKey from the array of keys.

Parameters:
elem the position of the colorKey in the array.
Returns:
false if out of range
void TMCGradient::SetColorKeyColor ( const int32  elem,
TMCColorRGBA color 
)

Sets the color for a colorKey.

Parameters:
elem the position of the colorKey in the array.
color the new color for this colorKey.
void TMCGradient::SetColorKeyIndex ( const int32  elem,
const real32  index 
)

Set the index for a colorKey.

Parameters:
elem the position of the colorKey in the array.
index the new index for this colorKey.

Member Data Documentation


The documentation for this class was generated from the following file:
Generated on Mon Apr 26 22:48:03 2010 for Carrara SDK Doc by  doxygen 1.6.3