sswf::Color Class Reference

A small object to hold an SWF color. More...

#include <libsswf.h>

List of all members.

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
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)
 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


Detailed Description

The Color class is used to specify an RGB and RGBA colors of objects.

When only an RGB color is necessary, you should pass a Color object with the alpha component set to 255 (solid).

See also:
SWF Alexis' Reference—swf_rgb

SWF Alexis' Reference—swf_xrgb

SWF Alexis' Reference—swf_rgba

SWF Alexis' Reference—swf_argb


Constructor & Destructor Documentation

sswf::Color::Color ( void   )  [inline]

The Color() constructor initialize the color with a call to Reset().

This is supposed to have the effect of setting the color to solid white.


Member Function Documentation

sswf::Color::Alpha ( void   )  const [inline]

The Alpha() function is used to read the alpha component of a Color object.

Returns:
The alpha component

sswf::Color::Blue ( void   )  const [inline]

The Blue() function is used to read the blue component of a Color object.

Returns:
The blue component

sswf::Color::Green ( void   )  const [inline]

The Green() function is used to read the green component of a Color object.

Returns:
The green component

sswf::Color::IsInvisible ( void   )  const [inline]

The IsInvisible() function returns true when the alpha is 0.

Returns:
'true' when alpha is 0

sswf::Color::IsSolid ( void   )  const [inline]

The IsSolid() function returns true when the alpha is 255.

Returns:
'false' when alpha is 255

bool Color::operator!= ( const Color color  )  const

The != operator compares two colors together and returns true when any of the components, including the alpha channel, does not match exactly.

Parameters:
[in] color The other color to compare 'this' with
Returns:
'true' when both colors are inequal

bool Color::operator== ( const Color color  )  const

The == operator compares two colors together and returns true when all the components, including the alpha channel, match exactly.

Parameters:
[in] color The other color to compare 'this' with
Returns:
'true' when both colors are equal

sswf::Color::Red ( void   )  const [inline]

The Red() function is used to read the red component of a Color object.

Returns:
The red component

void Color::Reset ( void   ) 

The Reset() function sets the color to solid white which is the default animation background color.

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

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.

Parameters:
[in] data The output buffer where the result is saved.
[in] save_alpha A flag used to specify whether the alpha is saved too

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.

Parameters:
[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


Member Data Documentation

unsigned char sswf::Color::f_alpha [private]

unsigned char sswf::Color::f_blue [private]

unsigned char sswf::Color::f_green [private]

unsigned char sswf::Color::f_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