Unpremultiply(Span, Int32, ReadOnlySpan, ReadOnlySpan, ReadOnlySpan) Method

Definition

Assembly Broadside.dll

Undoes the pre-blending of colour against a matte colour (Matte): c = m + (c′ − m) / α, clamped to each component's range; a sample with α = 0 becomes the matte colour.

public static void Unpremultiply(Span<float> colors, int components, ReadOnlySpan<float> alpha, ReadOnlySpan<float> matte, ReadOnlySpan<ComponentRange> ranges)

Parameters

colors
Span<Single>

Decoded components (after the Decode array; palette entries for an Indexed image), interleaved; changed in place.

components
Int32

The number of components per sample: the length of the matte array.

alpha
ReadOnlySpan<Single>

The soft mask's decoded value for each sample, 0 to 1.

matte
ReadOnlySpan<Single>

The matte colour, one value per component.

ranges
ReadOnlySpan<ComponentRange>

The range of each component, for the clamp.

Remarks

ISO 32000-2 §11.6.5.2, Table 144 and the formula after it: done in the image's own colour space, before conversion.