imageBufferToCanvas Function

Create a canvas element with the same dimensions and contents as an image buffer.

imageBufferToCanvas(buffer: ImageBuffer, preserveAlpha: boolean = true): HTMLCanvasElement | undefined

Parameter Type Description
buffer ImageBuffer the source ImageBuffer object from which the HTMLCanvasElement object will be constructed.
preserveAlpha boolean If false, the alpha channel will be set to 255 (fully opaque). This is recommended when converting an already-blended image (e.g., one obtained from Viewport.readImage).

Returns - an HTMLCanvasElement object containing the contents of the source image buffer, or undefined if the conversion fails.

Defined in

Last Updated: 13 August, 2019