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
open external var height: UInt53

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

Link copied to clipboard
Link copied to clipboard
open external var width: UInt53

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
open external 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 external override fun dispatchEvent(event: Event): Boolean
Link copied to clipboard
open external 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
open external fun transferToImageBitmap(): ImageBitmap

The transferToImageBitmap() method of the OffscreenCanvas interface creates an ImageBitmap object from the most recently rendered image of the OffscreenCanvas. The image in the OffscreenCanvas is replaced with a new blank image for subsequent rendering.

Link copied to clipboard
open external fun <T : Event> when(type: EventType<T>, options: ObservableEventListenerOptions?): Observable<T>