Function zipTransformInto

Applies one compile-time same-type two-input elementwise transform into a selected writable destination plane.

bool zipTransformInto(alias transform, T)(
  scope RasterView!T left,
  size_t leftPlaneIndex,
  scope RasterView!T right,
  size_t rightPlaneIndex,
  scope ref WritableRasterView!T destination,
  size_t destinationPlaneIndex,
  out RasterZipTransformError error
) nothrow @nogc @safe;

Canonical UFCS form:

left.zipTransformInto!transform( leftPlaneIndex, right, rightPlaneIndex, destination, destinationPlaneIndex, error );

The transform alias must be usable as:

@safe pure nothrow @nogc T, T -> T

Structural semantics:

- all three plane indices must be valid; - left, right and destination logical width/height must match; - matching empty shapes succeed without invoking transform; - non-empty destination mapping must be injective; - left/destination reachable sample bytes must be physically disjoint; - right/destination reachable sample bytes must be physically disjoint; - left/right physical overlap is allowed because both inputs are read-only; - every structural/alias failure occurs before the first destination write.

Every already-validated signed affine resident layout is supported.

The operation is coordinate-wise in each view's relative semantic coordinates. Resident Region2D origins do not need to be equal.

Raster-d performs no implicit conversion, clamping, saturation, numeric policy, image-domain interpretation or scheduling.

The function allocates nothing and retains no operand.

Example

Example reporting an invalid left plane through UFCS.

import raster;

alias add =
    (float left, float right)
    @safe pure nothrow @nogc
    => left + right;

RasterView!float left;
RasterView!float right;
WritableRasterView!float destination;

RasterZipTransformError error;

assert(
    !left.zipTransformInto!add(
        0,
        right,
        0,
        destination,
        0,
        error
    )
);

assert(
    error
    == RasterZipTransformError.invalidLeftPlane
);