gamutMapLocalMindeToLinearSRgb - multiple declarations

Function gamutMapLocalMindeToLinearSRgb

Maps an OKLCH color into linear sRGB with the Local MINDE strategy.

LinearSRgb!T gamutMapLocalMindeToLinearSRgb(T)(
  Oklch!T color
) pure nothrow @nogc @safe;

Choose Local MINDE when you want the reference-oriented perceptual mapping strategy. Negative finite chroma is canonicalized before mapping. Lightness at or above 1 maps to white and lightness at or below 0 maps to black. Already-in-gamut colors take the identity path after explicit conversion.

Non-finite input is not repaired. This is per-color mathematical mapping and does not define image-wide rendering intent, encoding, or alpha compositing.

Parameters

NameDescription
color OKLCH color to map.

Returns

A linear-sRGB color in gamut for finite mapped input.

Standards

Implements the Local MINDE SDR RGB gamut-mapping strategy described by W3C CSS Color Module Level 4.

Allocation

Does not allocate.

Complexity

O(1) per color with a fixed defensive iteration bound; cost is independent of image or collection size.

See Also

gamutMapRayTraceToLinearSRgb, clip

Example

Local MINDE is the reference-oriented perceptual mapping choice.

import color.oklch :
    OklabHued,
    Oklchd;

const vivid =
    Oklchd(
        0.70,
        0.30,
        OklabHued.fromDegrees(40.0)
    );

const mapped =
    vivid.gamutMapLocalMindeToLinearSRgb;

assert(mapped.inGamut);

Function gamutMapLocalMindeToLinearSRgb

Maps a straight-alpha OKLCH color using Local MINDE.

Alpha!(LinearSRgb!T) gamutMapLocalMindeToLinearSRgb(T)(
  Alpha!(Oklch!T) value
) pure nothrow @nogc @safe;

Only the wrapped color is mapped. Alpha is copied unchanged and is not clamped, premultiplied, composited, or otherwise interpreted.

Parameters

NameDescription
value Straight-alpha OKLCH value to map.

Returns

Straight-alpha linear sRGB with unchanged alpha.

Example

import color.oklch : OklabHued, Oklchd;

const value = Alpha!Oklchd(
    Oklchd(0.70, 0.30, OklabHued.fromDegrees(40.0)),
    0.40
);

const mapped = value.gamutMapLocalMindeToLinearSRgb;

assert(mapped.alpha == 0.40);
assert(mapped.color.inGamut);