Function RasterView.tryRoi

Attempts to create a child region relative to this view.

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

relative.x and relative.y are relative to the current view origin.

On success the returned RasterView:

- reuses the exact same stable descriptor block; - owns no new storage; - contains the resolved Region2D in the same resident descriptor coordinate system; - remains lifetime-bound to this view.

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

Empty child regions are valid when they are geometrically contained within the parent region.

Example

Example rejecting a child ROI outside an empty parent view.

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