JNGL
Easy to use cross-platform 2D game library
|
Object representing a RGBA color. More...
#include <jngl/Rgba.hpp>
Public Member Functions | |
Rgba (float red, float green, float blue, float alpha) | |
Rgba (float red, float green, float blue, Alpha alpha) | |
Rgba (Rgb, Alpha) | |
float | getRed () const |
0.0f ... 1.0f | |
void | setRed (float) |
0.0f ... 1.0f | |
float | getGreen () const |
0.0f ... 1.0fu | |
void | setGreen (float) |
0.0f ... 1.0f | |
float | getBlue () const |
0.0f ... 1.0f | |
void | setBlue (float) |
0.0f ... 1.0f | |
float | getAlpha () const |
0.0f ... 1.0f | |
void | setAlpha (float) |
0.0f ... 1.0f | |
void | setAlpha (Alpha) |
void | setRgb (Rgb color) |
Overwrites red, green and blue, but leaves the alpha value untouched. | |
operator Rgb () const | |
Drops the alpha value. | |
Static Public Member Functions | |
static Rgba | u8 (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) |
Object representing a RGBA color.
You can use the custom literal operator to create jngl::Rgba from HTML color codes. For example #68da4fee
becomes:
Rgba | ( | float | red, |
float | green, | ||
float | blue, | ||
float | alpha ) |
red | 0.0f ... 1.0f |
green | 0.0f ... 1.0f |
blue | 0.0f ... 1.0f |
alpha | 0.0f ... 1.0f |
Values over 1.0f will result in 1.0f and negatives will result in 0.0f.