readImage Method

Read the current image from this viewport from the rendering system. If a view rectangle outside the actual view is specified, the entire view is captured.

readImage(rect: ViewRect = new ViewRect(0, 0, -1, -1), targetSize: Point2d = Point2d.createZero(), flipVertically: boolean = false): ImageBuffer | undefined

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 - 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: 08 January, 2020