Polycode::Color Class Reference

Stores and manipulates color information. More...

List of all members.

Public Member Functions

 Color ()
 Default constructor.
 Color (int r, int g, int b, int a)
 Create from 0-255 integer data.
 Color (Number r, Number g, Number b, Number a)
 Create from 0-1 floating point data.
 Color (const Color *color)
 Create from another color.
 Color (unsigned int hex)
 Create from integer color.
Color operator* (const Color &v2) const
 Multiplies the color with another color.
Color operator+ (const Color &v2) const
 Adds the color to another color.
void setColorHex (unsigned int hex)
 Sets the color using an integer color value.
void setColorHexRGB (unsigned int hex)
 Sets the color using a 24-bit RGB integer color value.
void setColorHSV (Number h, Number s, Number v)
 Sets the color using HSV values.
void setColorRGBA (int r, int g, int b, int a)
 Sets the color using 0-255 RGBA integers.
void setColorRGB (int r, int g, int b)
 Sets the color using 0-255 RGB integers.
void setColor (Number r, Number g, Number b, Number a)
 Set from 0-1 floating point data.
void setColor (const Color *color)
 Set from another color.
void Random ()
 Sets the color to a random color.
Number getBrightness () const
 Retuns the brightness of the color.
Number getHue () const
 Returns the hue of the color's HSV component.
Number getSaturation () const
 Returns the saturation of the color's HSV component.
Number getValue () const
 Returns the value of the color's HSV component.
unsigned int getUint () const
 Returns the color as a 32-bit usigned integer.

Public Attributes

Number r
 Red value.
Number g
 Green value.
Number b
 Blue value.
Number a
 Alpha value.

Detailed Description

Stores and manipulates color information.

Color is always RGBA in Polycode.


Constructor & Destructor Documentation

Color::Color ( int  r,
int  g,
int  b,
int  a 
)

Create from 0-255 integer data.

Parameters:
r Red value 0-255.
g Green value 0-255.
b Blue value 0-255.
a Alpha value 0-255.
Color::Color ( Number  r,
Number  g,
Number  b,
Number  a 
)

Create from 0-1 floating point data.

Parameters:
r Red value 0-1.
g Green value 0-1
b Blue value 0-1
a Alpha value 0-1
Color::Color ( const Color color  ) 

Create from another color.

Parameters:
color The color to create from.
Color::Color ( unsigned int  hex  ) 

Create from integer color.

Parameters:
hex Integer color value.

Member Function Documentation

Number Color::getBrightness (  )  const

Retuns the brightness of the color.

Returns:
Brightness.
Number Color::getHue (  )  const

Returns the hue of the color's HSV component.

Returns:
HSV Hue.
Number Color::getSaturation (  )  const

Returns the saturation of the color's HSV component.

Returns:
HSV Saturation
unsigned int Color::getUint (  )  const

Returns the color as a 32-bit usigned integer.

Returns:
Color as a single 32-bit unsigned integer.
Number Color::getValue (  )  const

Returns the value of the color's HSV component.

Returns:
HSV Value
void Color::Random (  ) 

Sets the color to a random color.

This does not affect alpha.

void Color::setColor ( const Color color  ) 

Set from another color.

Parameters:
color The color to set from.
void Color::setColor ( Number  r,
Number  g,
Number  b,
Number  a 
)

Set from 0-1 floating point data.

Parameters:
r Red value 0-1.
g Green value 0-1
b Blue value 0-1
a Alpha value 0-1
void Color::setColorHex ( unsigned int  hex  ) 

Sets the color using an integer color value.

Parameters:
hex 32-bit integer with color values.
void Color::setColorHexRGB ( unsigned int  hex  ) 

Sets the color using a 24-bit RGB integer color value.

Parameters:
hex 24-bit integer with RGB color values.
void Color::setColorHSV ( Number  h,
Number  s,
Number  v 
)

Sets the color using HSV values.

Parameters:
h Hue.
s Saturation.
v Value.
void Color::setColorRGB ( int  r,
int  g,
int  b 
)

Sets the color using 0-255 RGB integers.

Parameters:
r Red value 0-255.
g Green value 0-255.
b Blue value 0-255.
void Color::setColorRGBA ( int  r,
int  g,
int  b,
int  a 
)

Sets the color using 0-255 RGBA integers.

Parameters:
r Red value 0-255.
g Green value 0-255.
b Blue value 0-255.
a Alpha value 0-255.
Generated on Sat Aug 11 18:04:10 2012 for Polycode by  doxygen 1.6.3