ManaPlus
|
#include <color.h>
Public Member Functions | |
Color () | |
Color (const unsigned int color) | |
Color (const unsigned int ar, const unsigned int ag, const unsigned int ab, const unsigned int aa) | |
Color | operator+ (const Color &color) const |
Color | operator- (const Color &color) const |
Color | operator* (const float value) const |
bool | operator== (const Color &color) const |
bool | operator!= (const Color &color) const |
Data Fields | |
unsigned int | r |
unsigned int | g |
unsigned int | b |
unsigned int | a |
Represents a color with red, green, blue and alpha components.
|
inline |
|
inlineexplicit |
Constructor. Constructs a color from the bytes in an integer. Call it with a hexadecimal constant for HTML-style color representation. The alpha component is 255 by default.
EXAMPLE: Color(0xff50a0) constructs a very nice pinkish color.
NOTE: Because of this constructor, integers will be automatically casted to a color by your compiler.
color | The color to initialise the object with. |
|
inline |
Constructor. The default alpha value is 255.
ar | Red color component (range 0-255). |
ag | Green color component (range 0-255). |
ab | Blue color component (range 0-255). |
aa | Alpha, used for transparency. A value of 0 means totaly transparent, 255 is totaly opaque. |
|
inline |
|
inline |
Multiplies the RGB values of a color with a float value. The values will be clamped if they go out of range.
value | The value to multiply the color with. |
Definition at line 190 of file color.h.
Adds the RGB values of two colors together. The values will be clamped if they go out of range.
WARNING: This function will reset the alpha value of the returned color to 255.
color | A color to add to this color. |
Definition at line 143 of file color.h.
Subtracts the RGB values of one color from another. The values will be clamped if they go out of range.
WARNING: This function will reset the alpha value of the returned color to 255.
color | A color to subtract from this color. |
Definition at line 167 of file color.h.
|
inline |
unsigned int Color::a |
Holds the alpha color component. A value of 0 means totally transparent while a value of 255 is considered opaque.
Definition at line 251 of file color.h.
Referenced by ColorPage::draw(), DropDown::draw(), ExtendedListBox::draw(), GuiTable::draw(), ListBox::draw(), ProgressBar::draw(), ServersListBox::draw(), ShopListBox::draw(), SkillListBox::draw(), SkillRectangleListBox::draw(), TextParticle::draw(), AvatarListBox::draw(), Font::drawString(), Font::generate(), Theme::getColor(), UserPalette::getColor(), UserPalette::getColorWithAlpha(), operator!=(), operator*(), TextChunkSmall::operator<(), operator==(), restoreColor(), GuiTable::safeDraw(), ProgressBar::safeDraw(), AvatarListBox::safeDraw(), and SDLputPixelAlpha().
unsigned int Color::b |
Holds the blue color component (range 0-255).
Definition at line 245 of file color.h.
Referenced by Palette::advanceGradient(), Setup_Colors::cancel(), ShopListBox::draw(), TextPreview::draw(), TextChunk::generate(), Palette::ColorElem::getRGB(), ProgressBar::logic(), operator!=(), operator*(), operator+(), operator-(), TextChunkSmall::operator<(), operator==(), restoreColor(), UserPalette::rollback(), SDLputPixel(), SDLputPixelAlpha(), UserPalette::setColor(), and Setup_Colors::valueChanged().
unsigned int Color::g |
Holds the green color component (range 0-255).
Definition at line 240 of file color.h.
Referenced by Palette::advanceGradient(), Setup_Colors::cancel(), ShopListBox::draw(), TextPreview::draw(), TextChunk::generate(), Palette::ColorElem::getRGB(), ProgressBar::logic(), operator!=(), operator*(), operator+(), operator-(), TextChunkSmall::operator<(), operator==(), restoreColor(), UserPalette::rollback(), SDLputPixel(), SDLputPixelAlpha(), UserPalette::setColor(), and Setup_Colors::valueChanged().
unsigned int Color::r |
Holds the red color component (range 0-255).
Definition at line 235 of file color.h.
Referenced by Palette::advanceGradient(), Setup_Colors::cancel(), ShopListBox::draw(), TextPreview::draw(), TextChunk::generate(), Palette::ColorElem::getRGB(), ProgressBar::logic(), operator!=(), operator*(), operator+(), operator-(), TextChunkSmall::operator<(), operator==(), restoreColor(), UserPalette::rollback(), SDLputPixel(), SDLputPixelAlpha(), UserPalette::setColor(), and Setup_Colors::valueChanged().