Function addInto

Adds corresponding samples from left and right into destination.

bool addInto(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
if (isRasterArithmeticSample!T);

Supported T:

byte, ubyte, short, ushort, int, uint, long, ulong, float, double

Integer result:

mathematical sum reduced modulo 2^N to T

Floating result:

D/IEEE-754 addition in T

All shape/layout/alias/failure semantics are exactly those of zipTransformInto(). In particular:

- all three selected planes must have matching shape; - matching empty shapes are a successful no-op; - destination must be injective for non-empty geometry; - source/source overlap is allowed; - either source overlapping destination is rejected before writing.

This wrapper allocates nothing and contains no pixel loop.

Example

Example reporting add failure through the shared zip-transform model.

import raster;
RasterView!float left;
RasterView!float right;
WritableRasterView!float destination;
RasterZipTransformError error;
assert(!addInto(left, 0, right, 0, destination, 0, error));
assert(error == RasterZipTransformError.invalidLeftPlane);