Function tryCopyRasterPlane

Copies one logical source plane to the corresponding logical samples of one equally shaped writable destination plane.

bool tryCopyRasterPlane(T)(
  scope RasterView!T source,
  size_t sourcePlaneIndex,
  scope ref WritableRasterView!T destination,
  size_t destinationPlaneIndex,
  out RasterCopyError error
) nothrow @nogc @safe;

source and destination use the same raster sample type.

A matching empty source/destination shape succeeds as a no-op.

The destination mapping must be injective.

Source self-aliasing is permitted. Source and destination may share backing storage when their actually reachable sample bytes are disjoint.

Actual source/destination sample-byte overlap is rejected before the first destination write. This operation does not provide snapshot or memmove semantics.

Returns true on success and false on a semantic request failure.

error is reset to RasterCopyError.none on entry. On false it identifies exactly one of:

- invalid source plane; - invalid destination plane; - shape mismatch; - non-injective destination mapping; - actual source/destination sample-byte overlap.

Every validated resident execution layout is semantically supported. Execution-layout selection and fallback behavior remain internal.

The operation is allocation-free and retains neither operand.

Example

Example reporting an invalid source plane before any write.

import raster;
RasterView!ubyte source;
WritableRasterView!ubyte destination;
RasterCopyError error;
assert(!tryCopyRasterPlane(source, 0, destination, 0, error));
assert(error == RasterCopyError.invalidSourcePlane);