withContiguousPlane - multiple declarations

Function withContiguousPlane

Visits one flat contiguous read plane without per-sample bounds checks.

bool withContiguousPlane(T)(
  scope const ref RasterView!T view,
  size_t planeIndex,
  scope nothrow @nogc @safe void delegate(scope const(T)[] samples, size_t width, size_t height) callback
) nothrow @nogc @safe;

Validation happens before the callback is entered. The slice is scoped to the callback and must not be retained by the caller. The callback is synchronous and must not start work that outlives the view borrow.

Returns false when planeIndex is invalid or the plane is not flat contiguous. Empty planes are valid and invoke the callback with an empty slice.

Function withContiguousPlane

Visits one flat contiguous writable plane without per-sample bounds checks.

bool withContiguousPlane(T)(
  scope ref WritableRasterView!T view,
  size_t planeIndex,
  scope nothrow @nogc @safe void delegate(scope T[] samples, size_t width, size_t height) callback
) nothrow @nogc @safe;

The callback receives a scoped mutable slice. This grants write access, not uniqueness or non-aliasing; callers remain responsible for obeying the documented source/destination alias rules of their operation.

Example

Example rejecting an invalid contiguous writable-plane request.

import raster;
WritableRasterView!ubyte view;
assert(!withContiguousPlane!ubyte(view, 0, null));