#include <libsswf.h>
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 |
| 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.
sswf::ColorTranform::SetAdd(double red, double green, double blue, double alpha)
sswf::ColorTranform::SetMult(double red, double green, double blue, double alpha)
ColorTransform::ColorTransform | ( | void | ) |
This function initializes the color transformation to no offset and no scaling of the colors.
sswf::ColorTransform::AddAlpha | ( | void | ) | const [inline] |
This function returns the current alpha offset.
sswf::ColorTransform::AddBlue | ( | void | ) | const [inline] |
This function returns the current blue offset.
sswf::ColorTransform::AddGreen | ( | void | ) | const [inline] |
This function returns the current green offset.
sswf::ColorTransform::AddRed | ( | void | ) | const [inline] |
This function returns the current red offset.
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.
[in] | with_alpha | Whether the alpha channel is tested |
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.
sswf::ColorTransform::MultAlpha | ( | void | ) | const [inline] |
This function returns the current alpha scaling.
sswf::ColorTransform::MultBlue | ( | void | ) | const [inline] |
This function returns the current blue scaling.
sswf::ColorTransform::MultGreen | ( | void | ) | const [inline] |
This function returns the current green scaling.
sswf::ColorTransform::MultRed | ( | void | ) | const [inline] |
This function returns the current red scaling.
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.
[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).
[in] | red | The red offset |
[in] | green | The green offset |
[in] | blue | The blue offset |
[in] | alpha | The alpha offset |
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).
[in] | red | The red scaling |
[in] | green | The green scaling |
[in] | blue | The blue scaling |
[in] | alpha | The alpha scaling |
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] |