readImageToCanvas Method


readImageToCanvas(options)

Reads the current image from this viewport into an HTMLCanvasElement with a Canvas2dRenderingContext such that additional 2d graphics can be drawn onto it. This overload allows for specifying whether canvas decorations will be omitted from the returned image by passing in ReadImageToCanvasOptions. The canvas decorations will be consistently omitted or included regardless of the number of active viewports.

readImageToCanvas(options: ReadImageToCanvasOptions): HTMLCanvasElement

Parameter Type Description
options ReadImageToCanvasOptions Options for reading the image to the canvas.

Returns - HTMLCanvasElement



readImageToCanvas()

Deprecated  in 5.0 Use the overload accepting a ReadImageToCanvasOptions.

Reads the current image from this viewport into an HTMLCanvasElement with a Canvas2dRenderingContext such that additional 2d graphics can be drawn onto it. When using this overload, the returned image will not include canvas decorations if only one viewport is active. If multiple viewports are active, the returned image will always include canvas decorations.

readImageToCanvas(): HTMLCanvasElement

Returns - HTMLCanvasElement


Defined in

Last Updated: 20 February, 2025