Polycode
|
Stores and manipulates color information. More...
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. |
Stores and manipulates color information.
Color is always RGBA in Polycode.
Color::Color | ( | int | r, |
int | g, | ||
int | b, | ||
int | a | ||
) |
Create from 0-255 integer data.
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.
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.
color | The color to create from. |
Color::Color | ( | unsigned int | hex | ) |
Create from integer color.
hex | Integer color value. |
Number Color::getBrightness | ( | ) | const |
Retuns the brightness of the color.
Number Color::getHue | ( | ) | const |
Returns the hue of the color's HSV component.
Number Color::getSaturation | ( | ) | const |
Returns the saturation of the color's HSV component.
unsigned int Color::getUint | ( | ) | const |
Returns the color as a 32-bit usigned integer.
Number Color::getValue | ( | ) | const |
Returns the value of the color's HSV component.
void Color::Random | ( | ) |
Sets the color to a random color.
This does not affect alpha.
void Color::setColor | ( | Number | r, |
Number | g, | ||
Number | b, | ||
Number | a | ||
) |
Set from 0-1 floating point data.
r | Red value 0-1. |
g | Green value 0-1 |
b | Blue value 0-1 |
a | Alpha value 0-1 |
void Color::setColor | ( | const Color * | color | ) |
Set from another color.
color | The color to set from. |
void Color::setColorHex | ( | unsigned int | hex | ) |
Sets the color using an integer color value.
hex | 32-bit integer with color values. |
void Color::setColorHexRGB | ( | unsigned int | hex | ) |
Sets the color using a 24-bit RGB integer color value.
hex | 24-bit integer with RGB color values. |
void Color::setColorHSV | ( | Number | h, |
Number | s, | ||
Number | v | ||
) |
Sets the color using HSV values.
h | Hue. |
s | Saturation. |
v | Value. |
void Color::setColorRGB | ( | int | r, |
int | g, | ||
int | b | ||
) |
Sets the color using 0-255 RGB integers.
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.
r | Red value 0-255. |
g | Green value 0-255. |
b | Blue value 0-255. |
a | Alpha value 0-255. |