canvasToImageBuffer Function
Create an ImageBuffer in the specified format with the same dimensions and contents as a canvas.
canvasToImageBuffer(canvas: HTMLCanvasElement, format: ImageBufferFormat = ImageBufferFormat.Rgba): ImageBuffer | undefined
extensions
Parameter | Type | Description |
---|---|---|
canvas | HTMLCanvasElement | the source HTMLCanvasElement object from which the ImageBuffer object will be constructed. |
format | ImageBufferFormat | the desired format of the created ImageBuffer; defaults to ImageBufferFormat.Rgba. |
Returns - ImageBuffer | undefined
an ImageBuffer object containing the contents of the source canvas, or undefined if the conversion fails.
Defined in
- core/frontend/src/ImageUtil.ts Line 118
Last Updated: 20 June, 2023