GameKit
0.0.1a
C++ gamedev tools
|
Utility class for manipulating RGBA colors. More...
#include <Color.hpp>
Public Member Functions | |
Color ()=default | |
Default constructor. More... | |
Color (u8 _r, u8 _g, u8 _b, u8 _a=255) | |
Construct the color from its 4 RGBA components. More... | |
void | invert () |
Color | operator+ (const Color &c) |
Overload of the binary + operator. More... | |
Color | operator- (const Color &c) |
Overload of the binary - operator. More... | |
bool | operator== (const Color &color) const |
Overload of binary operator ==. More... | |
bool | operator!= (const Color &color) const |
Overload of binary operator !=. More... | |
u8 | r255 () const |
u8 | g255 () const |
u8 | b255 () const |
u8 | a255 () const |
Public Attributes | |
float | r = 1.0f |
Red component. More... | |
float | g = 1.0f |
Green component. More... | |
float | b = 1.0f |
Blue component. More... | |
float | a = 1.0f |
Alpha (opacity) component. More... | |
Static Public Attributes | |
static const Color | Black |
Black predefined color. More... | |
static const Color | White |
White predefined color. More... | |
static const Color | Red |
Red predefined color. More... | |
static const Color | Green |
Green predefined color. More... | |
static const Color | Blue |
Blue predefined color. More... | |
static const Color | Yellow |
Yellow predefined color. More... | |
static const Color | Magenta |
Magenta predefined color. More... | |
static const Color | Cyan |
Cyan predefined color. More... | |
static const Color | Transparent |
Transparent (black) predefined color. More... | |
Utility class for manipulating RGBA colors.
This part of the documentation has been taken from SFML Once the migration to SFML 2.6 is done, this file will be removed
gk::Color is a simple color class composed of 4 components:
Each component is a public member, an unsigned integer in the range [0, 255]. Thus, colors can be constructed and manipulated very easily:
The fourth component of colors, named "alpha", represents the opacity of the color. A color with an alpha value of 255 will be fully opaque, while an alpha value of 0 will make a color fully transparent, whatever the value of the other components is.
The most common colors are already defined as static variables:
Colors can also be added and modulated (multiplied) using the overloaded operators + and *.
|
default |
Default constructor.
Constructs an opaque white color. It is equivalent to gk::Color(255, 255, 255, 255).
|
inline |
|
inline |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |