HTMLCanvasElement
Generated from idl/canvas.webidl when the site was built at 7aa23e2.
HTMLCanvasElement is an interface in idl/canvas.webidl, inheriting HTMLElement, exposed in Window. What it does is on MDN; this page says what niso has of it.
Status
Section titled “Status”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 |
|---|---|---|---|
| <canvas> | Widely available | Partial 68% 143 of 208 subtests pass | 6 |
Members
Section titled “Members”constructor
Section titled “constructor”[HTMLConstructor] constructor();attribute unsigned long width;int32_t niso_html_canvas_element_get_width(niso_dom* dom, niso_handle self, uint32_t* out);int32_t niso_html_canvas_element_set_width(niso_dom* dom, niso_handle self, uint32_t value);height
Section titled “height”attribute unsigned long height;int32_t niso_html_canvas_element_get_height(niso_dom* dom, niso_handle self, uint32_t* out);int32_t niso_html_canvas_element_set_height(niso_dom* dom, niso_handle self, uint32_t value);getContext()
Section titled “getContext()”[NisoGlue] RenderingContext? getContext(DOMString contextId, optional any options = null);toDataURL()
Section titled “toDataURL()”[NisoGlue] USVString toDataURL(optional DOMString type = "image/png", optional any quality);toBlob()
Section titled “toBlob()”[NisoGlue] undefined toBlob(BlobCallback callback, optional DOMString type = "image/png", optional any quality);context2d()
Section titled “context2d()”[NisoInternal] CanvasRenderingContext2D context2d(boolean alpha, boolean willReadFrequently);int32_t niso_html_canvas_element_context2d(niso_dom* dom, niso_handle self, bool alpha, bool will_read_frequently, niso_handle* out);The 2D context, made on the first call with its settings.
encodePng()
Section titled “encodePng()”[NisoInternal] ArrayBuffer encodePng();int32_t niso_html_canvas_element_encode_png(niso_dom* dom, niso_handle self, niso_bytes* out);The bitmap as a PNG file; empty without a bitmap.
Not in niso yet
Section titled “Not in niso yet”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.
captureElementImage(HTML-in-canvas)captureStream(captureStream() for <canvas>)clearElementGeometry(HTML-in-canvas)content(HTML-in-canvas)contextlost event(contextlost and contextrestored)contextrestored event(contextlost and contextrestored)elementgeometryupdate event(HTML-in-canvas)getElementImageDefaultSize(HTML-in-canvas)getElementTransform(HTML-in-canvas)paint event(HTML-in-canvas)requestPaint(HTML-in-canvas)transferControlToOffscreen(Offscreen canvas)updateElementGeometry(HTML-in-canvas)webglcontextcreationerror event(WebGL)webglcontextlost event(WebGL)webglcontextrestored event(WebGL)