Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

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 65 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 63 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 71 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 79 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 117 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 137 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 87 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 102 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 132 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 159 of file color.hpp.

Referenced by Color(), gcn::Window::draw(), gcn::ScrollArea::draw(), gcn::DropDown::draw(), gcn::Button::draw(), gcn::Window::drawBorder(), gcn::TextField::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::SDLGraphics::setColor(), and gcn::OpenGLGraphics::setColor().


The documentation for this class was generated from the following files:
Generated on Tue May 17 21:23:26 2005 for Guichan by  doxygen 1.4.1