Function tonesAtLightnessAndChromaInto

Applies fixed-size lightness and chroma schedules to an OKLCH seed hue.

void tonesAtLightnessAndChromaInto(T, ulong N)(
  Oklch!T seed,
  const ref T[N] lightnesses,
  const ref T[N] chromas,
  ref Oklch!T[N] output
) pure nothrow @nogc @safe
if (is(T == float) || is(T == double));

Use this when schedule cardinality is known statically and output storage is caller-owned. The lightness schedule, chroma schedule, and output have the same static cardinality. Each element applies the supplied raw lightness and chroma to the seed while preserving its stored hue. No clamping, canonicalization, anchoring, gamut mapping, or semantic palette policy is applied.

N == 0 and N == 1 are valid. Output is caller-owned.

Parameters

NameDescription
seed Source OKLCH color whose hue is preserved.
lightnesses Raw lightness schedule.
chromas Raw chroma schedule.
output Caller-owned output array.

Allocation

Does not allocate; all output storage is supplied by the caller.

Complexity

O(N).

See Also

tryTonesAtLightnessAndChromaInto

Example

const seed = Oklch!double(
    0.50,
    0.10,
    OklabHue!double.fromDegrees(210.0)
);
const double[3] lightnesses = [0.20, 0.50, 0.80];
const double[3] chromas = [0.04, 0.10, 0.06];
Oklch!double[3] tones;

tonesAtLightnessAndChromaInto(
    seed,
    lightnesses,
    chromas,
    tones
);

assert(tones[0].l == 0.20);
assert(tones[1].c == 0.10);
assert(tones[2].h.rawDegrees == seed.h.rawDegrees);