package js.html
extends Element › DOMElement › Node › EventTarget
Available on js
The HTMLCanvasElement interface provides properties and methods for manipulating the layout and presentation of canvas elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface.
Documentation HTMLCanvasElement by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
height:IntIs a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.
width:IntIs a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.
captureStream(?frameRate:Float):CanvasCaptureMediaStreamReturns a CanvasCaptureMediaStream that is a real-time video capture of the surface of the canvas.
Throws:
null |
DOMError |
|---|
getContext(contextId:String, ?contextOptions:Dynamic):DynamicReturns a drawing context on the canvas, or null if the context ID is not supported. A drawing context lets you draw on the canvas. Calling getContext with "2d" returns a CanvasRenderingContext2D object, whereas calling it with "webgl" (or "experimental-webgl") returns a WebGLRenderingContext object. This context is only available on browsers that implement WebGL.
Throws:
null |
DOMError |
|---|
inlinegetContext2d(?attribs:{}):CanvasRenderingContext2DShorthand for getting a CanvasRenderingContext2D.
inlinegetContextWebGL(?attribs:Null<ContextAttributes>):RenderingContextShorthand for getting a js.html.webgl.RenderingContext.
inlinegetContextWebGL2(?attribs:Null<ContextAttributes>):WebGL2RenderingContextShorthand for getting a js.html.webgl.WebGL2RenderingContext.
toBlob(callback:Blob ‑> Void, type:String = "", ?encoderOptions:Dynamic):VoidCreates a Blob object representing the image contained in the canvas; this file may be cached on the disk or stored in memory at the discretion of the user agent.
Throws:
null |
DOMError |
|---|
toDataURL(type:String = "", ?encoderOptions:Dynamic):StringReturns a data-URL containing a representation of the image in the format specified by the type parameter (defaults to png). The returned image is in a resolution of 96dpi.
Throws:
null |
DOMError |
|---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/CanvasElement.html