The OpenD Programming Language

Image.scanptr

Returns a scanline pointer to the y nth line of pixels, in the given layer. scanptr is a shortcut to index the first layer (layer index 0). Only possible if the image has plain pixels. What pixel format it points to, depends on the image type().

Guarantees by layout constraints:
 * next scanptr (if any) is returned pointer + pitchInBytes() bytes.
 * scanline pointer are aligned by given scanline alignment flags (at least).
 * after each scanline there is at least a number of trailing pixels given by layout flags
 * scanline pixels can be processed by multiplicity given by layout flags
 * around the image, there is a border whose width is at least the one given by layout flags.
 * it is valid, if the layout guarantees a border, to adress additional scanlines below 0 and
   above height()-1

For each scanline pointer, you can _always_ READ ptr[0..abs(pitchInBytes())] without memory error. However, WRITING to this scanline excess pixels doesn't guarantee anything by itself since the image could be a sub-image, and the underlying buffer could be shared.

struct Image
nothrow @nogc @safe inout pure @trusted
inout(void)*
scanptr
(
int y
)

Return Value

Type: inout(void)*

The scanline start. Next scanline (if any) is returned pointer + pitchInBytes() bytes If the layout has a border, you can adress pixels with a X coordinate in: -borderWidth to width - 1 + borderWidth. Note: It is also valid to call scanline() and scanptr() for images that have zero width, zero height, and/or zero layer. Tags: #valid #data #plain

Meta