gcn::Color Class Reference

#include <color.hpp>

List of all members.


Detailed Description

Represents a color with red, green, blue and alpha components.

Definition at line 67 of file color.hpp.

Public Member Functions

 Color ()
 Constructor.
 Color (int color)
 Constructs a color from the bytes in an integer.
 Color (int r, int g, int b, int a=255)
 Constructor.
Color operator+ (const Color &color) const
 Adds the RGB values of two colors together.
Color operator- (const Color &color) const
 Subtracts the RGB values of one color from another.
Color operator * (float value) const
 Multiplies the RGB values of a color with a float value.
bool operator== (const Color &color) const
 Compares two colors.
bool operator!= (const Color &color) const
 Compares two colors.

Public Attributes

int r
 Red color component (range 0-255).
int g
 Green color component (range 0-255).
int b
 Blue color component (range 0-255).
int a
 Color alpha, used for transparency.


Constructor & Destructor Documentation

gcn::Color::Color (  ) 

Constructor.

Initializes the color to black.

Definition at line 65 of file color.cpp.

References a, b, g, and r.

gcn::Color::Color ( int  color  ) 

Constructs a color from the bytes in an integer.

Call it with a hexadecimal constant for HTML-style color representation. The alpha component will be set to 255.

EXAMPLE: Color(0xff50a0) constructs Gui-chan's favourite color.

NOTE: Because of this constructor, integers will be automatically casted to a color by your compiler.

Parameters:
color the color.

Definition at line 73 of file color.cpp.

References a, b, g, and r.

gcn::Color::Color ( int  r,
int  g,
int  b,
int  a = 255 
)

Constructor.

Parameters:
r Red color component (range 0-255).
g Green color component (range 0-255).
b Blue color component (range 0-255).
a Color alpha, used for transparency. A value of 0 means totaly transparent, 255 is totaly opaque (the default).

Definition at line 81 of file color.cpp.


Member Function Documentation

Color gcn::Color::operator * ( float  value  )  const

Multiplies the RGB values of a color with a float value.

The values will be clamped if they go out of range.

Parameters:
value the value to multiply the color with.
Returns:
the resulting color with alpha untouched.

Definition at line 119 of file color.cpp.

References a, b, g, and r.

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

Compares two colors.

Returns:
true if the two colors have different RGBA components.

Definition at line 139 of file color.cpp.

References a, b, g, and r.

Color gcn::Color::operator+ ( const Color color  )  const

Adds the RGB values of two colors together.

The values will be clamped if they go out of range.

Parameters:
color a color to add to this color.
Returns:
the resulting color with alpha set to 255.

Definition at line 89 of file color.cpp.

References a, b, g, and r.

Color gcn::Color::operator- ( const Color color  )  const

Subtracts the RGB values of one color from another.

The values will be clamped if they go out of range.

Parameters:
color a color to subtract from this color.
Returns:
the resulting color with alpha set to 255.

Definition at line 104 of file color.cpp.

References a, b, g, and r.

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

Compares two colors.

Returns:
true if the two colors have the same RGBA components.

Definition at line 134 of file color.cpp.

References a, b, g, and r.


Member Data Documentation

int gcn::Color::a

Color alpha, used for transparency.

A value of 0 means totaly transparent, 255 is totaly opaque (the default)

Definition at line 161 of file color.hpp.

Referenced by Color(), gcn::Window::draw(), gcn::Slider::draw(), gcn::DropDown::draw(), gcn::Button::draw(), gcn::Window::drawBorder(), gcn::TextField::drawBorder(), gcn::Slider::drawBorder(), gcn::ScrollArea::drawBorder(), gcn::RadioButton::drawBorder(), gcn::ListBox::drawBorder(), gcn::Label::drawBorder(), gcn::Icon::drawBorder(), gcn::DropDown::drawBorder(), gcn::Container::drawBorder(), gcn::CheckBox::drawBorder(), gcn::Button::drawBorder(), gcn::RadioButton::drawBox(), gcn::CheckBox::drawBox(), gcn::DropDown::drawButton(), gcn::ScrollArea::drawDownButton(), gcn::ScrollArea::drawHBar(), gcn::SDLGraphics::drawHLine(), gcn::ScrollArea::drawHMarker(), gcn::ScrollArea::drawLeftButton(), gcn::Slider::drawMarker(), gcn::ScrollArea::drawRightButton(), gcn::ScrollArea::drawUpButton(), gcn::ScrollArea::drawVBar(), gcn::SDLGraphics::drawVLine(), gcn::ScrollArea::drawVMarker(), gcn::SDLGraphics::fillRectangle(), operator *(), operator!=(), operator+(), operator-(), operator==(), gcn::OpenGLImage::putPixel(), gcn::AllegroImage::putPixel(), gcn::SDLputPixelAlpha(), gcn::SDLGraphics::setColor(), gcn::OpenGLGraphics::setColor(), and gcn::AllegroGraphics::setColor().


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7