W3cubDocs

/Haxe JavaScript

CanvasElement

package js.html

extends ElementDOMElementNodeEventTarget

@:native("HTMLCanvasElement") 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:

Variables

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.

Methods

getContext (contextId:String, ?contextOptions:Dynamic):Dynamic

Throws:

null DOMError

inline getContext2d (?attribs:{}):CanvasRenderingContext2D

Shorthand for getting a CanvasRenderingContext2D.

inline getContextWebGL (?attribs:ContextAttributes):RenderingContext

Shorthand for getting a js.html.webgl.RenderingContext.

@:value({ type : "" }) toBlob (callback:Blob ‑> Void, type:String = "", ?encoderOptions:Dynamic):Void

Throws:

null DOMError

@:value({ type : "" }) toDataURL (type:String = "", ?encoderOptions:Dynamic):String

Throws:

null DOMError

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/CanvasElement.html