OffscreenCanvas

When using the canvas element or the Canvas API, rendering, animation, and user interaction usually happen on the main execution thread of a web application.

MDN Reference

Constructors

Link copied to clipboard
constructor(width: UInt53, height: UInt53)

Properties

Link copied to clipboard

The height property returns and sets the height of an OffscreenCanvas object.

Link copied to clipboard

The width property returns and sets the width of an OffscreenCanvas object.

Functions

Link copied to clipboard
suspend fun convertToBlob(options: ImageEncodeOptions = definedExternally): Blob

The OffscreenCanvas.convertToBlob() method creates a Blob object representing the image contained in the canvas.

Link copied to clipboard
fun convertToBlobAsync(options: ImageEncodeOptions = definedExternally): Promise<Blob>
Link copied to clipboard
Link copied to clipboard
fun <T : OffscreenRenderingContext, O : JsAny> getContext(contextId: RenderingContextId<T, O>, options: O? = definedExternally): T?

The OffscreenCanvas.getContext() method returns a drawing context for an offscreen canvas, or null if the context identifier is not supported, or the offscreen canvas has already been set to a different context mode.

Link copied to clipboard

The OffscreenCanvas.transferToImageBitmap() method creates an ImageBitmap object from the most recently rendered image of the OffscreenCanvas.

Link copied to clipboard