Struct Premultiplied

Stores premultiplied linear-light sRGB and its alpha.

struct Premultiplied(Color)
  
if (isSupportedPremultipliedColor!Color);

Use this representation for compositing. It is deliberately distinct from straight Alpha!Color so the two forms cannot be mixed accidentally.

Direct construction does not perform premultiplication: callers must supply coordinates that are already multiplied by the associated alpha. The natural .init state is detectably invalid because its floating components are NaN.

Fields

NameTypeDescription
alpha Premultiplied.ScalarRaw alpha value associated with the premultiplied coordinates.
color ColorWrapped premultiplied color coordinates.

Properties

NameTypeDescription
isValidAlpha[get] boolReports whether alpha is a usable opacity from 0 through 1.

Aliases

NameDescription
Scalar Scalar component type shared with the wrapped color.

Example

const value = Premultiplied!LinearSRgbf(
    LinearSRgbf(0.1f, 0.2f, 0.4f),
    0.5f
);

assert(value.color == LinearSRgbf(0.1f, 0.2f, 0.4f));
assert(value.alpha == 0.5f);
assert(value.isValidAlpha);