Function WritableRasterView.tryRoi

Attempts to create a writable child ROI relative to this view.

WritableRasterView!T tryRoi(
  Region2D relative,
  out bool success
) return pure nothrow @nogc @safe;

Writable certification is inherited because every reachable child sample is a subset of the already-certified parent sample set.

This method deliberately requires a mutable receiver. A const-qualified WritableRasterView must not be usable to recover a new writable child capability.

On failure success is false and WritableRasterView.init is returned.

Example

Example rejecting an out-of-range writable child ROI.

import raster;
WritableRasterView!ubyte view;
bool success;
scope auto child = view.tryRoi(Region2D(1, 0, 0, 0), success);
assert(!success);
assert(child.empty);