Function premultiply
Prepares straight linear-light sRGB for premultiplied-alpha compositing.
Each RGB coordinate is multiplied by alpha and alpha itself is preserved. No validation, clipping, gamut mapping, or color-space conversion occurs. At zero alpha, finite hidden straight RGB becomes transparent black.
Parameters
| Name | Description |
|---|---|
| value | Straight-alpha linear-light sRGB value. |
Returns
The corresponding premultiplied representation.
See Also
unpremultiply
Example
const straight = Alpha!LinearSRgbf(
LinearSRgbf(0.5f, 1.25f, -0.25f),
0.5f
);
const value = premultiply(straight);
assert(value .color == LinearSRgbf(0.25f, 0.625f, -0.125f));
assert(value .alpha == 0.5f);