Gosu::Color Class Reference

Represents an ARGB color value with 8 bits for each channel. More...

List of all members.

Public Types

typedef boost::uint8_t Channel

Public Member Functions

 Color ()
 The default constructor does not initialize the color to any value.
 Color (boost::uint32_t argb)
 Conversion constructor for literals of the form 0xaarrggbb.
 Color (Channel red, Channel green, Channel blue)
 Color (Channel alpha, Channel red, Channel green, Channel blue)
Channel alpha () const
Channel red () const
Channel green () const
Channel blue () const
void setAlpha (Channel value)
void setRed (Channel value)
void setGreen (Channel value)
void setBlue (Channel value)
double hue () const
 Returns the hue of the color, in the usual range of 0..360.
void setHue (double h)
 Changes the current color so hue() will return h.
double saturation () const
 Returns the saturation of the color, in the range of 0..1.
void setSaturation (double s)
 Changes the current color so saturation() will return s.
double value () const
 Returns the value (brightness) of the color, in the range of 0..1.
void setValue (double v)
 Changes the current color so value() will return v.
boost::uint32_t argb () const
 Returns the color in 0xaarrggbb representation.
boost::uint32_t bgr () const
 Returns the color in 0x00bbggrr representation.
boost::uint32_t abgr () const
 Returns the color in 0xaabbggrr representation.

Static Public Member Functions

static Color fromHSV (double h, double s, double v)
 Constructs a color from the given hue/saturation/value triple.
static Color fromAHSV (Channel alpha, double h, double s, double v)

Static Public Attributes

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


Detailed Description

Represents an ARGB color value with 8 bits for each channel.

Can be implicitly constructed from literals of the form 0xaarrggbb. Has fast value semantics.

Definition at line 14 of file Color.hpp.


Member Typedef Documentation

typedef boost::uint8_t Gosu::Color::Channel

Definition at line 19 of file Color.hpp.


Constructor & Destructor Documentation

Gosu::Color::Color (  ) 

The default constructor does not initialize the color to any value.

Definition at line 22 of file Color.hpp.

Gosu::Color::Color ( boost::uint32_t  argb  ) 

Conversion constructor for literals of the form 0xaarrggbb.

(C++ only.)

Definition at line 28 of file Color.hpp.

Gosu::Color::Color ( Channel  red,
Channel  green,
Channel  blue 
)

Definition at line 33 of file Color.hpp.

Gosu::Color::Color ( Channel  alpha,
Channel  red,
Channel  green,
Channel  blue 
)

Definition at line 38 of file Color.hpp.


Member Function Documentation

boost::uint32_t Gosu::Color::abgr (  )  const

Returns the color in 0xaabbggrr representation.

Definition at line 125 of file Color.hpp.

References alpha(), and bgr().

Channel Gosu::Color::alpha (  )  const

Definition at line 50 of file Color.hpp.

Referenced by abgr().

boost::uint32_t Gosu::Color::argb (  )  const

Returns the color in 0xaarrggbb representation.

Definition at line 113 of file Color.hpp.

Referenced by Gosu::operator!=(), Gosu::operator<(), and Gosu::operator==().

boost::uint32_t Gosu::Color::bgr (  )  const

Returns the color in 0x00bbggrr representation.

Definition at line 119 of file Color.hpp.

References blue(), and red().

Referenced by abgr().

Channel Gosu::Color::blue (  )  const

Definition at line 65 of file Color.hpp.

Referenced by bgr().

static Color Gosu::Color::fromAHSV ( Channel  alpha,
double  h,
double  s,
double  v 
) [static]

static Color Gosu::Color::fromHSV ( double  h,
double  s,
double  v 
) [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.

Channel Gosu::Color::green (  )  const

Definition at line 60 of file Color.hpp.

double Gosu::Color::hue (  )  const

Returns the hue of the color, in the usual range of 0..360.

Channel Gosu::Color::red (  )  const

Definition at line 55 of file Color.hpp.

Referenced by bgr().

double Gosu::Color::saturation (  )  const

Returns the saturation of the color, in the range of 0..1.

void Gosu::Color::setAlpha ( Channel  value  ) 

Definition at line 70 of file Color.hpp.

void Gosu::Color::setBlue ( Channel  value  ) 

Definition at line 88 of file Color.hpp.

void Gosu::Color::setGreen ( Channel  value  ) 

Definition at line 82 of file Color.hpp.

void Gosu::Color::setHue ( double  h  ) 

Changes the current color so hue() will return h.

void Gosu::Color::setRed ( Channel  value  ) 

Definition at line 76 of file Color.hpp.

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.


Member Data Documentation

const Color Gosu::Color::AQUA [static]

Definition at line 135 of file Color.hpp.

const Color Gosu::Color::BLACK [static]

Definition at line 131 of file Color.hpp.

const Color Gosu::Color::BLUE [static]

Definition at line 138 of file Color.hpp.

const Color Gosu::Color::CYAN [static]

Definition at line 141 of file Color.hpp.

const Color Gosu::Color::FUCHSIA [static]

Definition at line 140 of file Color.hpp.

const Color Gosu::Color::GRAY [static]

Definition at line 132 of file Color.hpp.

const Color Gosu::Color::GREEN [static]

Definition at line 137 of file Color.hpp.

const Color Gosu::Color::NONE [static]

Definition at line 130 of file Color.hpp.

const Color Gosu::Color::RED [static]

Definition at line 136 of file Color.hpp.

const Color Gosu::Color::WHITE [static]

Definition at line 133 of file Color.hpp.

const Color Gosu::Color::YELLOW [static]

Definition at line 139 of file Color.hpp.


The documentation for this class was generated from the following file: