blend
Composites a source color over a backdrop with a blend mode, as the browser does for
mix-blend-mode (W3C Compositing and Blending Level 1, source-over). Both colors are straight
(non-premultiplied); the maths run in premultiplied space and the result is straight again,
each channel and the alpha rounded to the nearest 8-bit value.
Import
Section titled “Import”Cargo feature color (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
backdrop | Rgba | The color underneath. |
source | Rgba | The color painted over it. |
mode | BlendMode | The blend mode; BlendMode::Normal is a plain alpha composite. |
Returns
Section titled “Returns”Rgba — The straight result. Transparent black when both colors are fully transparent.
