Function tryTransformRasterPlane

Applies one compile-time same-type point transform from a selected source plane into a selected writable destination plane.

bool tryTransformRasterPlane(alias transform, T)(
  scope RasterView!T source,
  size_t sourcePlaneIndex,
  scope ref WritableRasterView!T destination,
  size_t destinationPlaneIndex,
  out RasterTransformError error
) nothrow @nogc @safe;

The transform alias must be callable as:

@safe pure nothrow @nogc T -> T

This requirement is checked by template instantiation.

Structural semantics:

- source and destination plane indices must be valid; - logical source/destination shapes must match; - a matching empty shape succeeds without invoking transform; - the writable destination mapping must be injective; - reachable source/destination sample bytes must be physically disjoint; - every structural failure occurs before the first destination write.

Every validated resident affine layout is semantically supported.

Raster-d performs no implicit numeric conversion, clamping, saturation, NaN normalization, signed-zero normalization, FMA selection or image-domain interpretation. Each successful destination sample receives exactly the T value returned by transform for the corresponding logical source sample.

The operation allocates nothing and retains no operand.

Example

Example reporting an invalid source plane for a compile-time transform.

import raster;
alias plusOne = (float value) @safe pure nothrow @nogc => value + 1.0f;
RasterView!float source;
WritableRasterView!float destination;
RasterTransformError error;
assert(!tryTransformRasterPlane!plusOne(source, 0, destination, 0, error));
assert(error == RasterTransformError.invalidSourcePlane);