SubPixmap.extractToPixmap

Copies the pixel data – cropped to the subimage region – into the target Pixmap.

Do not attempt to extract a subimage back into the source pixmap. This will fail in cases where source and target regions overlap and potentially crash the program.
struct SubPixmap
@safe pure nothrow @nogc const
extractToPixmap

Return Value

Type: Pixmap

A size-adjusted shallow copy of the input Pixmap overwritten with the image data of the SubPixmap.

While the returned Pixmap utilizes the buffer provided by the input, the returned Pixmap might not exactly match the input. The dimensions (width and height) and the length might have changed.

Always use the returned Pixmap structure.

// Same buffer, but new structure:
auto pixmap2 = subPixmap.extractToPixmap(pixmap);

// Alternatively, replace the old structure:
pixmap = subPixmap.extractToPixmap(pixmap);

Meta