|
| Color (void) |
| Construct a fully-opaque black color (0,0,0,1).
|
|
| Color (float r, float g, float b) |
| Construct from RGB, alpha defaults to 1.0.
|
|
| Color (float r, float g, float b, float a) |
| Construct from RGBA.
|
|
float | r (void) const |
| Red component in [0,1].
|
|
float | g (void) const |
| Green component in [0,1].
|
|
float | b (void) const |
| Blue component in [0,1].
|
|
float | a (void) const |
| Alpha component in [0,1].
|
|
void | setR (float v) |
| Setters (values are clamped to [0,1]).
|
|
void | setG (float v) |
| Set green component.
|
|
void | setB (float v) |
| Set blue component.
|
|
void | setA (float v) |
| Set alpha component.
|
|
Color | withAlpha (float alpha) const |
| Return a copy with a different alpha (keeps RGB).
|
|
Color | lerp (const Color &to, float t) const |
| Linear interpolation between two colors (component-wise).
|
|
Color | premultiplied () const |
| Premultiplied alpha representation.
|
|
Color | over (const Color &bg) const |
| Alpha blend this color over a background color. Uses standard source-over compositing in linear space.
|
|
RGBA8 | toRGBA8 () const |
| Convert to 8-bit per channel RGBA.
|
|
std::string | toHex (bool includeAlphaIfOpaque=false) const |
| Convert to hexadecimal string. Formats as "#RRGGBB" if a==1 else "#RRGGBBAA".
|
|
bool | operator== (const Color &other) const |
| Equality operators (exact component-wise equality).
|
|
bool | operator!= (const Color &other) const |
| Inequality operator.
|
|
Color | operator+ (const Color &o) const |
| Component-wise addition (clamped).
|
|
Color | operator- (const Color &o) const |
| Component-wise subtraction (clamped to [0,1]).
|
|
Color | operator* (float s) const |
| Scalar multiplication (scales RGB; alpha unchanged by default).
|
|
Represents an RGBA color with floating-point channels in [0, 1].
The Color class stores red, green, blue, and alpha components as floats clamped to the [0,1] range. It provides convenient constructors, conversion utilities to and from 8-bit channel values and hexadecimal strings, as well as basic color operations.
Definition at line 42 of file color.hpp.