Skip to content

OffscreenCanvas

Generated from idl/canvas.webidl when the site was built at 7aa23e2.

OffscreenCanvas is an interface in idl/canvas.webidl, inheriting EventTarget, exposed in Window, Worker. What it does is on MDN; this page says what niso has of it.

The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).

Feature On the web In niso Members
Offscreen canvas Widely available Partial 69% 1069 of 1545 subtests pass 7
constructor
constructor([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height);
int32_t niso_offscreen_canvas_new(niso_dom* dom, uint64_t width, uint64_t height, niso_handle* out);
attribute
attribute unsigned long long width;
int32_t niso_offscreen_canvas_get_width(niso_dom* dom, niso_handle self, uint64_t* out);
int32_t niso_offscreen_canvas_set_width(niso_dom* dom, niso_handle self, uint64_t value);

[EnforceRange] on the setters is the glue’s.

attribute
attribute unsigned long long height;
int32_t niso_offscreen_canvas_get_height(niso_dom* dom, niso_handle self, uint64_t* out);
int32_t niso_offscreen_canvas_set_height(niso_dom* dom, niso_handle self, uint64_t value);
operation
[NisoGlue] OffscreenCanvasRenderingContext2D? getContext(DOMString contextId, optional any options = null);
operation not in JS
[NisoInternal] OffscreenCanvasRenderingContext2D context2d(boolean alpha);
int32_t niso_offscreen_canvas_context2d(niso_dom* dom, niso_handle self, bool alpha, niso_handle* out);
operation
ImageBitmap transferToImageBitmap();
int32_t niso_offscreen_canvas_transfer_to_image_bitmap(niso_dom* dom, niso_handle self, niso_handle* out);
operation
[NisoGlue] Promise<Blob> convertToBlob(optional any options = null);
operation not in JS
[NisoInternal] ArrayBuffer encodePng();
int32_t niso_offscreen_canvas_encode_png(niso_dom* dom, niso_handle self, niso_bytes* out);

Members the web has, by the BCD keys web-features 3.45.0 lists, that idl/ doesn’t declare. The list is partial: web-features lists only the keys it maps to a feature.

  • clearElementGeometry (HTML-in-canvas)
  • contextlost event (contextlost and contextrestored)
  • contextrestored event (contextlost and contextrestored)
  • getElementImageDefaultSize (HTML-in-canvas)
  • updateElementGeometry (HTML-in-canvas)