Represents an RGBA color value with 8 bits for each channel. More...
Public Types | |
| typedef std::tr1::uint8_t | Channel |
Public Member Functions | |
| Color () | |
| The default constructor does not initialize the color to any value. More... | |
| Color (unsigned argb) | |
| Conversion constructor for literals of the form 0xaarrggbb. More... | |
| Color (Channel red, Channel green, Channel blue) | |
| Color (Channel alpha, Channel red, Channel green, Channel blue) | |
| Channel | red () const |
| Channel | green () const |
| Channel | blue () const |
| Channel | alpha () const |
| void | setRed (Channel value) |
| void | setGreen (Channel value) |
| void | setBlue (Channel value) |
| void | setAlpha (Channel value) |
| double | hue () const |
| Returns the hue of the color, in the usual range of 0..360. More... | |
| void | setHue (double h) |
| Changes the current color so hue() will return h. More... | |
| double | saturation () const |
| Returns the saturation of the color, in the range of 0..1. More... | |
| void | setSaturation (double s) |
| Changes the current color so saturation() will return s. More... | |
| double | value () const |
| Returns the value (brightness) of the color, in the range of 0..1. More... | |
| void | setValue (double v) |
| Changes the current color so value() will return v. More... | |
| std::tr1::uint32_t | argb () const |
| Returns the color in 0xaarrggbb representation. More... | |
| std::tr1::uint32_t | bgr () const |
| Returns the color in 0x00bbggrr representation. Useful for Win32 programming. More... | |
| std::tr1::uint32_t | abgr () const |
| Returns the color in 0xaabbggrr representation. More... | |
| std::tr1::uint32_t | gl () const |
| Returns the internal representation of the color (RGBA in memory). More... | |
Static Public Member Functions | |
| static Color | fromHSV (double h, double s, double v) |
| Constructs a color from the given hue/saturation/value triple. More... | |
| static Color | fromAHSV (Channel alpha, double h, double s, double v) |
Static Public Attributes | |
| static const unsigned | GL_FORMAT = 0x1908 |
| static const Color | NONE |
| static const Color | BLACK |
| static const Color | GRAY |
| static const Color | WHITE |
| static const Color | AQUA |
| static const Color | RED |
| static const Color | GREEN |
| static const Color | BLUE |
| static const Color | YELLOW |
| static const Color | FUCHSIA |
| static const Color | CYAN |
Represents an RGBA color value with 8 bits for each channel.
Can be implicitly constructed from literals of the form 0xaarrggbb. Has fast value semantics. The four-byte layout in memory is RGBA. On Big-Endian machines the unsigned int interpretation is 0xrrggbbaa, on Little-Endian machines it is 0xaabbggrr.
| typedef std::tr1::uint8_t Gosu::Color::Channel |
| Gosu::Color::Color | ( | ) |
| Gosu::Color::Color | ( | unsigned | argb | ) |
| std::tr1::uint32_t Gosu::Color::abgr | ( | ) | const |
| Channel Gosu::Color::alpha | ( | ) | const |
| std::tr1::uint32_t Gosu::Color::argb | ( | ) | const |
| std::tr1::uint32_t Gosu::Color::bgr | ( | ) | const |
| Channel Gosu::Color::blue | ( | ) | const |
|
static |
Constructs a color from the given hue/saturation/value triple.
Ranges of these values are given as 0..360, 0..1 and 0..1, respectively. The alpha value is set to 1 from this method.
| std::tr1::uint32_t Gosu::Color::gl | ( | ) | const |
Returns the internal representation of the color (RGBA in memory).
Definition at line 142 of file Color.hpp.
Referenced by Gosu::operator!=(), Gosu::operator<(), and Gosu::operator==().
| Channel Gosu::Color::green | ( | ) | const |
| double Gosu::Color::hue | ( | ) | const |
Returns the hue of the color, in the usual range of 0..360.
| Channel Gosu::Color::red | ( | ) | const |
| double Gosu::Color::saturation | ( | ) | const |
Returns the saturation of the color, in the range of 0..1.
| void Gosu::Color::setHue | ( | double | h | ) |
Changes the current color so hue() will return h.
| void Gosu::Color::setSaturation | ( | double | s | ) |
Changes the current color so saturation() will return s.
| void Gosu::Color::setValue | ( | double | v | ) |
Changes the current color so value() will return v.
| double Gosu::Color::value | ( | ) | const |
Returns the value (brightness) of the color, in the range of 0..1.