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:Int
Is 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:Int
Is 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):CanvasCaptureMediaStream
Returns a CanvasCaptureMediaStream
that is a real-time video capture of the surface of the canvas.
Throws:
null |
DOMError |
---|
getContext(contextId:String, ?contextOptions:Dynamic):Dynamic
Returns 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:{}):CanvasRenderingContext2D
Shorthand for getting a CanvasRenderingContext2D.
inlinegetContextWebGL(?attribs:Null<ContextAttributes>):RenderingContext
Shorthand for getting a js.html.webgl.RenderingContext.
inlinegetContextWebGL2(?attribs:Null<ContextAttributes>):WebGL2RenderingContext
Shorthand for getting a js.html.webgl.WebGL2RenderingContext.
toBlob(callback:Blob ‑> Void, type:String = "", ?encoderOptions:Dynamic):Void
Creates 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):String
Returns 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