sswf::ColorTransform Class Reference

The simple color transform of a TagPlace tag. More...

#include <libsswf.h>

List of all members.

Public Member Functions

double AddAlpha (void) const
 Get the current alpha offset.
double AddBlue (void) const
 Get the current blue offset.
double AddGreen (void) const
 Get the current green offset.
double AddRed (void) const
 Get the current red offset.
 ColorTransform (void)
 Initializes a color tranformation to "no transformation".
bool IsNull (bool with_alpha) const
 Check whether this transformation has an effect.
bool IsSolidCompatible (void) const
 Check whether this color transform has no alpha.
double MultAlpha (void) const
 Get the current alpha scaling.
double MultBlue (void) const
 Get the current blue scaling.
double MultGreen (void) const
 Get the current green scaling.
double MultRed (void) const
 Get the current red scaling.
void Reset (void)
 Resets the transformation to the identity matrix.
void Save (Data &data, bool save_alpha=true)
 Save the color transformation in a buffer.
void SetAdd (double red, double green, double blue, double alpha=0.0)
 Set the color offsets.
void SetMult (double red, double green, double blue, double alpha=1.0)
 Set the color scalings.

Private Attributes

double f_add_alpha
double f_add_blue
double f_add_green
double f_add_red
double f_mult_alpha
double f_mult_blue
double f_mult_green
double f_mult_red


Detailed Description

Up to version 7, only a ColorTransform can be used to change the colors of the objects. This color transformation uses a simplified matrix like this:

  | s 0 0 0 0 |
  | 0 s 0 0 0 |
  | 0 0 s 0 0 |
  | 0 0 0 s 0 |
  | o o o o 1 |

The 's' represents the scaling and it is set with sswf::ColorTranform::SetMult(double red, double green, double blue, double alpha). or one of the specific color functions. By default the scalings are set to 1.0f.

The 'o' represents the offset and it is set with sswf::ColorTranform::SetAdd(double red, double green, double blue, double alpha) or one of the specific color functions. By default the offsets are set to 0.0f.

There is no way to apply a rotation to your colors with this limited color transformation.

See also:
sswf::ColorTranform::Reset(void)

sswf::ColorTranform::SetAdd(double red, double green, double blue, double alpha)

sswf::ColorTranform::SetMult(double red, double green, double blue, double alpha)

SWF Alexis' Reference—swf_color_transform


Constructor & Destructor Documentation

ColorTransform::ColorTransform ( void   ) 

This function initializes the color transformation to no offset and no scaling of the colors.

See also:
sswf::ColorTransform::Reset(void)


Member Function Documentation

sswf::ColorTransform::AddAlpha ( void   )  const [inline]

This function returns the current alpha offset.

Returns:
The alpha offset.
See also:
sswf::ColorTransform::AddRed(void) const

sswf::ColorTransform::AddGreen(void) const

sswf::ColorTransform::AddBlue(void) const

sswf::ColorTransform::AddBlue ( void   )  const [inline]

This function returns the current blue offset.

Returns:
The blue offset.
See also:
sswf::ColorTransform::AddRed(void) const

sswf::ColorTransform::AddGreen(void) const

sswf::ColorTransform::AddAlpha(void) const

sswf::ColorTransform::AddGreen ( void   )  const [inline]

This function returns the current green offset.

Returns:
The green offset.
See also:
sswf::ColorTransform::AddRed(void) const

sswf::ColorTransform::AddBlue(void) const

sswf::ColorTransform::AddAlpha(void) const

sswf::ColorTransform::AddRed ( void   )  const [inline]

This function returns the current red offset.

Returns:
The red offset.
See also:
sswf::ColorTransform::AddGreen(void) const

sswf::ColorTransform::AddBlue(void) const

sswf::ColorTransform::AddAlpha(void) const

bool ColorTransform::IsNull ( bool  with_alpha  )  const

This function returns true if all the offsets are zeroes (0.0f) and the scalings are all ones (1.0f).

The test is performed with the internal values transformed to 16 bits signed 8.8 fixed values. This means rounding may be applied before the test is applied.

This function is used to know whether a color transform needs to be saved in the output. A null color transform is not saved if not really necessary.

Parameters:
[in] with_alpha Whether the alpha channel is tested
Returns:
true if the color transform matrix will have no effect on the user colors.
See also:
sswf::ColorTransform::IsSolidCompatible(void) const

TagBase::Double2Signed16(double value)

bool ColorTransform::IsSolidCompatible ( void   )  const

This function checks whether the color transform has an alpha channel offset set to zero (0.0f) and a scaling of one (1.0f).

The test is performed with the internal values transformed to 16 bits signed 8.8 fixed values. This means rounding may be applied before the test is applied.

Returns:
true if the color transform is solid
See also:
sswf::ColorTransform::IsNull(bool with_alpha) const

TagBase::Double2Signed16(double value)

sswf::ColorTransform::MultAlpha ( void   )  const [inline]

This function returns the current alpha scaling.

Returns:
The alpha scaling.
See also:
sswf::ColorTransform::MultRed(void) const

sswf::ColorTransform::MultGreen(void) const

sswf::ColorTransform::MultBlue(void) const

sswf::ColorTransform::MultBlue ( void   )  const [inline]

This function returns the current blue scaling.

Returns:
The blue scaling.
See also:
sswf::ColorTransform::MultRed(void) const

sswf::ColorTransform::MultGreen(void) const

sswf::ColorTransform::MultAlpha(void) const

sswf::ColorTransform::MultGreen ( void   )  const [inline]

This function returns the current green scaling.

Returns:
The green scaling.
See also:
sswf::ColorTransform::MultRed(void) const

sswf::ColorTransform::MultBlue(void) const

sswf::ColorTransform::MultAlpha(void) const

sswf::ColorTransform::MultRed ( void   )  const [inline]

This function returns the current red scaling.

Returns:
The red scaling.
See also:
sswf::ColorTransform::MultGreen(void) const

sswf::ColorTransform::MultBlue(void) const

sswf::ColorTransform::MultAlpha(void) const

void ColorTransform::Reset ( void   ) 

This function removes the effect of any previous transformation. The offsets are set to all zeroes (0.0f) and the multiplicators are all set to 1.0f.

void ColorTransform::Save ( Data data,
bool  save_alpha = true 
)

This function saves the color transformation matrix in the specified data buffer.

The function ensures that the result is saved as compressed as possible. If the scalings are all ones (1.0f), then it is not saved. If the offsets are all zeroes (0.0f), then it is not saved.

The number of bits used to save the scaling and offset values is computed so the smallest possible number of bits is used.

Parameters:
[in] data The buffer where the color transform is saved
[in] save_alpha Whether the alpha channel needs to be saved

void ColorTransform::SetAdd ( double  red,
double  green,
double  blue,
double  alpha = 0.0 
)

This function lets you define the color offsets.

By default the offsets are all zeroes (0.0f).

Parameters:
[in] red The red offset
[in] green The green offset
[in] blue The blue offset
[in] alpha The alpha offset
See also:
ColorTransform::SetMult(double red, double green, double blue, double alpha)

void ColorTransform::SetMult ( double  red,
double  green,
double  blue,
double  alpha = 1.0 
)

This function lets you define the color scalings.

By default the scalings are all ones (1.0f).

Parameters:
[in] red The red scaling
[in] green The green scaling
[in] blue The blue scaling
[in] alpha The alpha scaling
See also:
ColorTransform::SetAdd(double red, double green, double blue, double alpha)


Member Data Documentation

double sswf::ColorTransform::f_add_alpha [private]

double sswf::ColorTransform::f_add_blue [private]

double sswf::ColorTransform::f_add_green [private]

double sswf::ColorTransform::f_add_red [private]

double sswf::ColorTransform::f_mult_alpha [private]

double sswf::ColorTransform::f_mult_blue [private]

double sswf::ColorTransform::f_mult_green [private]

double sswf::ColorTransform::f_mult_red [private]


The documentation for this class was generated from the following files:
Generated on Sun May 13 23:29:39 2007 for libsswf by  doxygen 1.4.7