![]() |
TGX 1.0.7
A tiny 2D/3D graphics library optimized for 32 bits microcontrollers.
|
Color in R,G,B float format. More...
#include <Color.h>
Public Member Functions | |
| RGBf ()=default | |
| Default constructor. More... | |
| constexpr | RGBf (float r, float g, float b) |
| Constructor from raw r,g,b values in [0.0f, 1.0f]. | |
| constexpr | RGBf (fVec3 v) |
| Constructor from a fVec3 with components (x=R, y=G, z=B) in [0.0f, 1.0f]. | |
| constexpr | RGBf (fVec4 v) |
| Constructor from a fVec4 with components (x=R, y=G, z=B, w=ignored) in [0.0f, 1.0f]. | |
| constexpr | RGBf (uint16_t val) |
| Constructor from a uint16_t (seen as RGB565). | |
| constexpr | RGBf (uint32_t val) |
| Constructor from a uint32_t (seen as RGB32, the A component is ignored). | |
| constexpr | RGBf (uint64_t val) |
| Constructor from a uint64_t (seen as RGB64, the A component is ignored). | |
| constexpr | RGBf (const RGBf &)=default |
| Default Copy constructor. | |
| constexpr | RGBf (const RGB565 &c) |
| Constructor from a RGB565 color. | |
| constexpr | RGBf (const RGB24 &c) |
| Constructor from a RGB24 color. | |
| constexpr | RGBf (const RGB32 &c) |
| Constructor from a RGB32 color. More... | |
| constexpr | RGBf (const RGB64 &c) |
| Constructor from a RGB64 color. More... | |
| RGBf (const HSV &c) | |
| Constructor from a HSV color. | |
| operator fVec3 () const | |
| Cast into an fVec3 in [0.0f, 1.0f]. | |
| RGBf & | operator= (const RGBf &)=default |
| Default assignement operator. | |
| RGBf & | operator= (const RGB565 &c) |
| Assignement operator from a RGB565 color. | |
| RGBf & | operator= (const RGB24 &c) |
| Assignement operator from a RGB24 color. | |
| RGBf & | operator= (const RGB32 &c) |
| Assignement operator from a RGB32 color. More... | |
| RGBf & | operator= (const RGB64 &c) |
| Assignement operator from a RGB64 color. More... | |
| RGBf & | operator= (const HSV &c) |
| Assignement operator from a HSV color. | |
| RGBf & | operator= (fVec3 v) |
| Assignement operator from a fVec3 with components (x=R, y=G, z=B) in [0.0f, 1.0f]. | |
| RGBf & | operator= (fVec4 v) |
| Assignement operator from a fVec4 with components (x=R, y=G, z=B, w=ignored) in [0.0f, 1.0f]. | |
| void | operator+= (const RGBf &c) |
| Add another color, component by component. | |
| void | operator-= (const RGBf &c) |
| Substract another color, component by component. | |
| void | operator*= (const RGBf &c) |
| Multiply each channel by the same channel on c. | |
| RGBf | operator* (const RGBf &c) const |
| Return the color obtained by multipliying the channels of both colors together. | |
| void | operator*= (float a) |
| Multiply each channel by a constant. | |
| RGBf | operator* (float a) const |
| Return the color where all components are multiplied by a. | |
| constexpr bool | operator== (const RGBf &c) const |
| Equality comparator. | |
| constexpr bool | operator!= (const RGBf &c) const |
| Inequality comparator. | |
| void | clamp () |
| Clamp all color channel to [0.0f,1.0f]. | |
| void | blend256 (const RGB64 &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 | blend (const RGBf &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 | 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 | |
| float | R |
| Red channel. | |
| float | G |
| Green channel. | |
| float | B |
| Blue channel. | |
Color in R,G,B float format.
Occupies 4*3 = 12 bytes in memory, aligned as float.
|
default |
Default constructor.
Color is undefined.
|
inlineconstexpr |
Constructor from a RGB32 color.
The A component of c is ignored.
|
inlineconstexpr |
Constructor from a RGB64 color.
The A component of c is ignored.
Assignement operator from a RGB32 color.
The component A is ignored.
Assignement operator from a RGB64 color.
The component A is ignored.
|
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 |
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 |
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.