premultiply
Multiplies the color channels by the alpha, the form a renderer composites with (a
translucent color then adds to what is underneath without a further multiplication).
Channels are rounded to 8 bits, so unpremultiply gives back the
original only approximately for translucent colors, and not at all for alpha 0.
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 |
|---|---|---|
color | Rgba | The straight color. |
Returns
Section titled “Returns”Rgba — The premultiplied color, with the same alpha.
