readImage Method

Read the current image from this viewport from the rendering system. If a "null" rectangle is supplied (See: ViewRect.isNull), the entire view is captured.

readImage(rect: ViewRect = ..., targetSize: Point2d = ..., flipVertically: boolean = false): undefined | ImageBuffer

note By default the image is returned with the coordinate (0,0) referring to the bottom-most pixel. Pass true for flipVertically to flip it along the x-axis.

Parameter Type Description
rect ViewRect The area of the view to read. The origin of a viewRect must specify the upper left corner.
targetSize Point2d The size of the image to be returned. The size can be larger or smaller than the original view.
flipVertically boolean If true, the image is flipped along the x-axis.

Returns - undefined | ImageBuffer

The contents of the viewport within the specified rectangle as a bitmap image, or undefined if the image could not be read.

Defined in

Last Updated: 12 June, 2024