#include <libsswf.h>
Public Member Functions | |
unsigned char | Alpha (void) const |
Returns the alpha (or transparency) component. | |
unsigned char | Blue (void) const |
Returns the blue component. | |
Color (void) | |
Construct a color object. | |
unsigned char | Green (void) const |
Returns the green component. | |
bool | IsInvisible (void) const |
Checks whether this color is invisible. | |
bool | IsSolid (void) const |
Checks whether this color represents a solid color. | |
bool | operator!= (const Color &color) const |
operator != compares two colors for inequality | |
bool | operator== (const Color &color) const |
operator == compares two colors for equality | |
ErrorManager::error_code_t | Parse (const Data &data, bool parse_alpha=true) |
Parse input data as 3 or 4 bytes of color. | |
unsigned char | Red (void) const |
Returns the red component. | |
void | Reset (void) |
Reset the color to its default values. | |
void | Save (Data &data, bool save_alpha=true) const |
Save the color to a Data buffer. | |
void | Set (unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255) |
Set the color to the specified values. | |
Private Attributes | |
unsigned char | f_alpha |
unsigned char | f_blue |
unsigned char | f_green |
unsigned char | f_red |
When only an RGB color is necessary, you should pass a Color object with the alpha component set to 255 (solid).
SWF Alexis' Reference—swf_xrgb
sswf::Color::Color | ( | void | ) | [inline] |
sswf::Color::Alpha | ( | void | ) | const [inline] |
The Alpha() function is used to read the alpha component of a Color object.
References f_alpha.
Referenced by sswf::Style::SetColor(), sswf::Style::SetGradient(), and sswf::Style::SetLine().
sswf::Color::Blue | ( | void | ) | const [inline] |
The Blue() function is used to read the blue component of a Color object.
References f_blue.
Referenced by sswf::TagSetBackgroundColor::Save().
sswf::Color::Green | ( | void | ) | const [inline] |
The Green() function is used to read the green component of a Color object.
References f_green.
Referenced by sswf::TagSetBackgroundColor::Save().
sswf::Color::IsInvisible | ( | void | ) | const [inline] |
The IsInvisible() function returns true when the alpha is 0.
References f_alpha.
Referenced by sswf::TagText::Save().
sswf::Color::IsSolid | ( | void | ) | const [inline] |
The IsSolid() function returns true when the alpha is 255.
References f_alpha.
Referenced by sswf::TagText::PreSave().
bool Color::operator!= | ( | const Color & | color | ) | const |
bool Color::operator== | ( | const Color & | color | ) | const |
ErrorManager::error_code_t Color::Parse | ( | const Data & | data, | |
bool | parse_alpha = true | |||
) |
This function reads colors from the specified Data buffer.
If the parse_alpha
flag is set to true, then 4 bytes are read. The 4th is the Alpha Channel.
When parse_alpha is set to false, the f_alpha parameter is set to 255.
[in] | data | The data buffer the color is read from |
[in] | parse_alpha | Whether the function reads the alpha channel |
References sswf::ErrorManager::ERROR_CODE_NONE, f_alpha, f_blue, f_green, f_red, and sswf::Data::GetByte().
Referenced by sswf::TagSetBackgroundColor::ParseTag(), and sswf::TagEditText::ParseTag().
sswf::Color::Red | ( | void | ) | const [inline] |
The Red() function is used to read the red component of a Color object.
References f_red.
Referenced by sswf::TagSetBackgroundColor::Save().
void Color::Reset | ( | void | ) |
void Color::Save | ( | Data & | data, | |
bool | save_alpha = true | |||
) | const |
The Save() function saves the color to a Data buffer.
The 'save_alpha' flag can be used to determine whether the alpha should also be saved.
This function saves the color as RGB or RGBA. To save the color as XRGB or ARGB you need to write your own code.
[in] | data | The output buffer where the result is saved. |
[in] | save_alpha | A flag used to specify whether the alpha is saved too |
References f_alpha, f_blue, f_green, f_red, and sswf::Data::PutByte().
Referenced by sswf::TagText::Save(), sswf::TagEditText::Save(), and sswf::Style::Save().
void Color::Set | ( | unsigned char | red, | |
unsigned char | green, | |||
unsigned char | blue, | |||
unsigned char | alpha = 255 | |||
) |
The Set() function sets the color to the specified red, green, blue and alpha values.
0 represent none and 255 represents full color.
For the alpha, 0 represent 100% transparent and 255 represents 100% solid. Notice that by default the alpha will be set to 255 which means a solid color.
[in] | red | The value for the red component |
[in] | green | The value for the green component |
[in] | blue | The value for the blue component |
[in] | alpha | The value for the alpha component |
References f_alpha, f_blue, f_green, and f_red.
Referenced by sswf::TagText::Save(), and sswf::TagShape::Save().
unsigned char sswf::Color::f_alpha [private] |
Referenced by Alpha(), IsInvisible(), IsSolid(), operator!=(), operator==(), Parse(), Reset(), Save(), and Set().
unsigned char sswf::Color::f_blue [private] |
Referenced by Blue(), operator!=(), operator==(), Parse(), Reset(), Save(), and Set().
unsigned char sswf::Color::f_green [private] |
Referenced by Green(), operator!=(), operator==(), Parse(), Reset(), Save(), and Set().
unsigned char sswf::Color::f_red [private] |
Referenced by operator!=(), operator==(), Parse(), Red(), Reset(), Save(), and Set().