$treeview $search $mathjax
Stratagus  2.2.6
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
           Stratagus - A free fantasy real time strategy game engine

gcn::Color Class Reference

#include <color.h>

List of all members.


Public Member Functions

 Color ()
 Color (int color)
 Color (int r, int g, int b, int a=255)
Color operator+ (const Color &color) const
Color operator- (const Color &color) const
Color operator* (float value) const
bool operator== (const Color &color) const
bool operator!= (const Color &color) const

Public Attributes

int r
int g
int b
int a

Detailed Description

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

Constructor & Destructor Documentation

Color::Color (  ) 

Constructor. Initializes the color to black.

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.

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).


Member Function Documentation

Color 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.

Color 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.

Color 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.

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

Compares two colors.

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

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

Compares two colors.

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


Member Data Documentation

Red color component (range 0-255).

Green color component (range 0-255).

Blue color component (range 0-255).

Color alpha, used for transparency. A value of 0 means totaly transparent, 255 is totaly opaque (the default)


The documentation for this class was generated from the following files:
(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.