Function PreparedMachado2009.tryTransformInto

Applies the prepared transform to runtime-sized caller-owned storage.

bool tryTransformInto(
  const(LinearSRgb!T)[] input,
  LinearSRgb!T[] output
) const pure nothrow @nogc @safe;

Returns false and performs no writes on a length mismatch. Exact in-place use is supported.

Allocation

Does not allocate.

Complexity

O(N) on success and O(1) on a length mismatch.

Example

PreparedMachado2009!double prepared;

assert(tryPrepareMachado2009(
    RedGreenCvdDeficiency.protan,
    0.5,
    prepared
));

const LinearSRgbd[1] input = [
    LinearSRgbd(0.2, 0.4, 0.7)
];
LinearSRgbd[1] output;

assert(prepared.tryTransformInto(input[], output[]));
assert(
    output[0] ==
    input[0].machado2009(
        RedGreenCvdDeficiency.protan,
        0.5
    )
);
}