![]() |
TGX 1.0.3
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
Color in R8/G8/B8 format. More...
#include <Color.h>
Public Member Functions | |
RGB24 ()=default | |
Default contructor. More... | |
constexpr | RGB24 (int r, int g, int b) |
Constructor from raw r,g,b values in [0,255]. | |
constexpr | RGB24 (iVec3 v) |
Constructor from a iVec3 with component (x=R, y=G, z=B). More... | |
constexpr | RGB24 (iVec4 v) |
Constructor from a iVec4 with component (x=R, y=G, z=B, w=ignored). More... | |
RGB24 (float r, float g, float b) | |
Constructor from float r,g,b in [0.0f, 1.0f]. | |
RGB24 (fVec3 v) | |
Constructor from a fVec3 with component (x=R, y=G, z=B) in [0.0f, 1.0f]. | |
RGB24 (fVec4 v) | |
Constructor from a fVec3 with component (x=R, y=G, z=B, w=ignored) in [0.0f, 1.0f]. | |
constexpr | RGB24 (uint8_t *p) |
Constructor from a uint8_t pointer to 3 bytes in the following order: R,G,B. | |
RGB24 (const RGB24 &)=default | |
Default Copy constructor. | |
constexpr | RGB24 (uint16_t c) |
Constructor from a uint16_t (seen as RGB565). | |
constexpr | RGB24 (uint32_t c) |
Constructor from a uint32_t (seen as RGB32). | |
constexpr | RGB24 (uint64_t c) |
Constructor from a uint64_t (seen as RGB64). | |
constexpr | RGB24 (const RGB565 &c) |
Constructor from a RGB24 color. | |
constexpr | RGB24 (const RGB32 &c) |
Constructor from a RGB32 color. More... | |
constexpr | RGB24 (const RGB64 &c) |
Constructor from a RGB64 color. More... | |
constexpr | RGB24 (const RGBf &c) |
Constructor from a RGBf color. | |
RGB24 (const HSV &c) | |
Constructor from a HSV color. | |
operator iVec3 () const | |
Cast into an iVec3. More... | |
operator fVec3 () const | |
Cast into an fVec3. More... | |
RGB24 & | operator= (const RGB24 &)=default |
Default assignement operator. | |
RGB24 & | operator= (const RGB565 &c) |
Assignement operator from a RGB565 color. | |
RGB24 & | operator= (const RGB32 &c) |
Assignement operator from a RGB32 color. More... | |
RGB24 & | operator= (const RGB64 &c) |
Assignement operator from a RGB64 color. More... | |
RGB24 & | operator= (const RGBf &c) |
Assignement operator from a RGBf color. | |
RGB24 & | operator= (const HSV &c) |
Assignement operator from a HSV color. | |
RGB24 & | operator= (iVec3 v) |
Assignement operator from a iVec3 vector (x=R, y=G, z=B). More... | |
RGB24 & | operator= (iVec4 v) |
Assignement operator from a iVec4 vector (x=R, y=G, z=B, w=ignored). More... | |
RGB24 & | operator= (fVec3 v) |
Assignement operator from a fVec3 vector (x=R, y=G, z=B). More... | |
RGB24 & | operator= (fVec4 v) |
Assignement operator from a fVec4 vector (x=R, y=G, z=B, w=ignored). More... | |
void | operator+= (const RGB24 &c) |
Add another color, component by component. | |
void | operator-= (const RGB24 &c) |
Substract another color, component by component. | |
void | operator+= (uint8_t v) |
Add the scalar value v to each component. | |
void | operator-= (uint8_t v) |
Substract the scalar value v to each component. | |
void | operator*= (uint8_t v) |
Multiply each component by the scalar value v. | |
void | operator*= (float v) |
Multiply each component by the scalar (floating point) value v. | |
void | operator/= (uint8_t v) |
Divide each component by the scalar value v. | |
void | operator/= (float v) |
Divide each component by the scalar (floating point value) v. | |
constexpr bool | operator== (const RGB24 &c) const |
Equality comparator. | |
constexpr bool | operator!= (const RGB24 &c) const |
Inequality comparator. | |
void | blend (const RGB24 &fg_col, float alpha) |
alpha-blend fg_col over this one with a given opacity in the range 0.0f (fully transparent) to 1.0f (fully opaque). More... | |
void | blend256 (const RGB24 &fg_col, uint32_t alpha) |
alpha-blend fg_col over this one with a given opacity in the integer range 0 (fully transparent) to 256 (fully opaque). More... | |
void | mult256 (int mr, int mg, int mb) |
Multiply each color component by a given factor m/256 with m in [0,256]. | |
void | mult256 (int mr, int mg, int mb, int ma) |
Multiply each color component by a given factor m/256 with m in [0,256]. More... | |
void | premultiply () |
Dummy function for compatibility with color types having an alpha channel. More... | |
float | opacity () const |
Dummy function for compatibility with color types having an alpha channel. More... | |
void | setOpacity (float op) |
Dummy function for compatibility with color types having an alpha channel. More... | |
Public Attributes | |
uint8_t | R |
Red channel (8bits) | |
uint8_t | G |
Green channel (8bits) | |
uint8_t | B |
Blue channel (8bits) | |
Color in R8/G8/B8 format.
Occupies 3 bytes in memory. No alignement.
Remark This color type should only be used when memory space is really tight but RGB565 does not offer enough resolution. Use RGB32 instead when possible (even if not using the alpha component) because most operations will be faster with correct 4 bytes alignment.
|
default |
Default contructor.
Color is undefined.
|
inlineconstexpr |
Constructor from a iVec3 with component (x=R, y=G, z=B).
All values in [0,255].
|
inlineconstexpr |
Constructor from a iVec4 with component (x=R, y=G, z=B, w=ignored).
All values in [0,255].
|
inlineconstexpr |
Constructor from a RGB32 color.
The component A is ignored
|
inlineconstexpr |
Constructor from a RGB64 color.
The component A is ignored
Assignement operator from a RGB32 color.
The component A is ignored.
Assignement operator from a RGB64 color.
The component A is ignored.
Assignement operator from a iVec3 vector (x=R, y=G, z=B).
Raw values.
Assignement operator from a iVec4 vector (x=R, y=G, z=B, w=ignored).
Raw values.
Assignement operator from a fVec3 vector (x=R, y=G, z=B).
All values in [0.0f, 1.0f].
Assignement operator from a fVec4 vector (x=R, y=G, z=B, w=ignored).
All values in [0.0f, 1.0f].
|
inline |
alpha-blend fg_col
over this one with a given opacity in the range 0.0f (fully transparent) to 1.0f (fully opaque).
fg_col | The foreground color. |
alpha | The opacity/alpha multiplier in [0.0f, 1.0f]. |
|
inline |
alpha-blend fg_col
over this one with a given opacity in the integer range 0 (fully transparent) to 256 (fully opaque).
fg_col | The foreground color. |
alpha | The opacity/alpha multiplier in [0, 256]. |
|
inline |
Multiply each color component by a given factor m/256 with m in [0,256].
Parameter ma is ignored since there is not alpha channel.
|
inline |
Dummy function for compatibility with color types having an alpha channel.
Does nothing since the color is always fully opaque.
|
inline |
Dummy function for compatibility with color types having an alpha channel.
Return 1.0f (fully opaque)
|
inline |
Dummy function for compatibility with color types having an alpha channel.
Does nothing since the color is always fully opaque.