Function WritableRasterView.trySetSample

Attempts to write one logical sample.

bool trySetSample(
  size_t band,
  size_t x,
  size_t y,
  T value
) nothrow @nogc @trusted;

Coordinates are relative to this view.

Returns false without writing when the band or coordinates are outside the represented view.

This is the narrow trusted mutable sample-access boundary.

Safety argument:

- creation of WritableRasterView is restricted to a package boundary whose caller has already certified complete writable resource coverage; - ordinary retained-backing validation already proved descriptor alignment, coordinate representation, stride-product arithmetic, combined offsets, and physical reachability; - a child ROI can only narrow that already-certified sample set; - the bounds checks below keep x/y inside the certified Region2D; - the cast from access-neutral const(void)* to T* consumes the previously established writable capability; it does not create that capability.

The type promises no uniqueness or non-aliasing.

Example

Example rejecting a write outside the default writable view.

import raster;
WritableRasterView!ubyte view;
assert(!view.trySetSample(0, 0, 0, cast(ubyte) 7));
}