OffscreenCanvas

When using the element or the Canvas API, rendering, animation, and user interaction usually happen on the main execution thread of a web application. The computation relating to canvas animations and rendering can have a significant impact on application performance.

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
inline suspend fun OffscreenCanvas.convertToBlob(): 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>

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

Link copied to clipboard
open fun dispatchEvent(event: Event): Boolean
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. The OffscreenCanvas allocates a new image for its subsequent rendering.

Link copied to clipboard