![]() |
TGX 1.0.5
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
Color in R5/G6/B5 format. More...
#include <Color.h>
Public Member Functions | |
RGB565 ()=default | |
Default constructor. More... | |
constexpr | RGB565 (int r, int g, int b) |
Constructor from R,G,B values. More... | |
constexpr | RGB565 (iVec3 v) |
Constructor from a iVec3 vector (x=R, y=G, z=B). More... | |
constexpr | RGB565 (iVec4 v) |
Constructor from an iVec4 vector (x=R, y=G, z=B, w=ignored). More... | |
RGB565 (float r, float g, float b) | |
Constructor from float r,g,b in [0.0f, 1.0f]. | |
RGB565 (fVec3 v) | |
Constructor from a fVec3 vector with components (x=R, y=G, z=B) in [0.0f, 1.0f]. | |
RGB565 (fVec4 v) | |
Constructor from a fVec4 vector with components (x=R, y=G, z=B, w=ignored) in [0.0f, 1.0f]. | |
constexpr | RGB565 (uint16_t c) |
Constructor from a uint16_t. | |
constexpr | RGB565 (uint32_t val) |
Constructor from a uint32_t (seen as RGB32). | |
constexpr | RGB565 (uint64_t val) |
Constructor from a uint64_t (seen as RGB64). | |
constexpr | RGB565 (const RGB565 &)=default |
Default Copy constructor. | |
constexpr | RGB565 (const RGB24 &c) |
Constructor from a RGB24 color. | |
constexpr | RGB565 (const RGB32 &c) |
Constructor from a RGB32 color. More... | |
constexpr | RGB565 (const RGB64 &c) |
Constructor from a RGB64 color. More... | |
constexpr | RGB565 (const RGBf &c) |
Constructor from a RGBf color. | |
RGB565 (const HSV &c) | |
Constructor from a HSV color. | |
operator uint16_t & () | |
Cast into a uint16_t (non-const reference version) | |
operator const uint16_t & () const | |
Cast into a uint16_t (const reference version) | |
operator iVec3 () const | |
Cast into an iVec3 vector. More... | |
operator fVec3 () const | |
Cast into an fVec3 vector. More... | |
RGB565 & | operator= (const RGB565 &)=default |
Default assignement operator. | |
RGB565 & | operator= (const RGB24 &c) |
Assignement operator from a RGB24 color. | |
RGB565 & | operator= (const RGB32 &c) |
Assignement operator from a RGB32 color. More... | |
RGB565 & | operator= (const RGB64 &c) |
Assignement operator from a RGB64 color. More... | |
RGB565 & | operator= (const RGBf &c) |
Assignement operator from a RGBf color. | |
RGB565 & | operator= (const HSV &c) |
Assignement operator from a HSV color. | |
RGB565 & | operator= (iVec3 v) |
Assignement operator from an iVec3 vector. More... | |
RGB565 & | operator= (iVec4 v) |
Assignement operator from a iVec4. More... | |
RGB565 & | operator= (fVec3 v) |
Assignement operator from a fVec3. More... | |
RGB565 & | operator= (fVec4 v) |
Assignement operator from a fVec4. More... | |
void | operator+= (const RGB565 &c) |
Add another color, component by component. | |
void | operator-= (const RGB565 &c) |
Substract another color, component by component. | |
constexpr bool | operator== (const RGB565 &c) const |
Equality comparator. | |
constexpr bool | operator!= (const RGB565 &c) const |
Inequality comparator. | |
void | blend (RGB565 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 RGB565 &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 x/256 with x 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 | |
union { | |
uint16_t val | |
color as uint16_t | |
struct { | |
uint16_t B: 5 | |
Blue channel (5 bits) | |
uint16_t G: 6 | |
Green channel (6 bits) | |
uint16_t R: 5 | |
Red channel (5 bits) | |
} | |
}; | |
Color in R5/G6/B5 format.
The object occupies 2 bytes in memory (aligned as uint16_t)
Can be converted from/to uint16_t.
This type is used mostly with MCU / embedded systems.
|
default |
Default constructor.
** color is undefined ***
|
inlineconstexpr |
Constructor from R,G,B values.
r | in [0,31] |
g | in [0,63] |
b | in [0,31] |
|
inlineconstexpr |
Constructor from a iVec3 vector (x=R, y=G, z=B).
|
inlineconstexpr |
Constructor from an iVec4 vector (x=R, y=G, z=B, w=ignored).
|
inlineconstexpr |
Constructor from a RGB32 color.
The component A is ignored
|
inlineconstexpr |
Constructor from a RGB64 color.
The component A is ignored
|
inlineexplicit |
Cast into an fVec3 vector.
Values in [0.0f, 1.0f].
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 an iVec3 vector.
Raw values (no conversion).
Assignement operator from a iVec4.
The w
component is ignored. Raw values (no conversion).
Assignement operator from a fVec3.
All values in [0.0f, 1.0f].
Assignement operator from a fVec4.
the w
component is 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 x/256 with x 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.