tiny-skia-cpp
A C++20 2D rendering library (port of tiny-skia)
Loading...
Searching...
No Matches
tiny_skia::Color Class Reference

Floating-point RGBA color [0,1] (straight alpha).

#include <tiny_skia/Color.h>

Collaboration diagram for tiny_skia::Color:

Public Member Functions

void applyOpacity (float opacity)
 Multiplies alpha by opacity (clamped to [0,1]).
 
PremultipliedColor premultiply () const
 Converts to premultiplied alpha.
 
ColorU8 toColorU8 () const
 Converts to 8-bit color.
 

Static Public Member Functions

static Color fromRgbaUnchecked (float red, float green, float blue, float alpha)
 Creates without validation (values must be in [0,1]).
 
static std::optional< ColorfromRgba (float red, float green, float blue, float alpha)
 Creates with validation. Returns nullopt if any component is outside [0,1].
 
static Color fromRgba8 (AlphaU8 red, AlphaU8 green, AlphaU8 blue, AlphaU8 alpha)
 Creates from 8-bit components.
 

The documentation for this class was generated from the following file: