Function tryTonesAtLightnessAndChromaInto

Applies runtime-sized lightness and chroma schedules to an OKLCH seed hue.

bool tryTonesAtLightnessAndChromaInto(T)(
  Oklch!T seed,
  const(T)[] lightnesses,
  const(T)[] chromas,
  Oklch!T[] output
) pure nothrow @nogc @safe
if (is(T == float) || is(T == double));

Use this when schedule length is known only at runtime. The operation succeeds only when the lightness, chroma, and output slices have equal length. On mismatch it returns false and performs no writes. An empty input/output triple is a successful empty operation.

No allocation, clamping, canonicalization, anchoring, gamut mapping, or semantic palette policy is applied.

Parameters

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

Returns

true on an exact length match; otherwise false with output unchanged.

Allocation

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

Complexity

O(N) on success and O(1) when the slice lengths do not match.

See Also

tonesAtLightnessAndChromaInto

Example

const seed = Oklch!double(
    0.50,
    0.10,
    OklabHue!double.fromDegrees(210.0)
);
const double[] lightnesses = [0.25, 0.75];
const double[] chromas = [0.05, 0.15];
Oklch!double[2] output;

assert(tryTonesAtLightnessAndChromaInto(
    seed,
    lightnesses,
    chromas,
    output[]
));
assert(output[0].l == 0.25);
assert(output[1].c == 0.15);