CanvasElement
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:
Instance Members
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.
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.
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.
| Name |
Type |
Default |
contextId |
String |
|
contextOptions |
Dynamic |
(optional) |
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.
| Name |
Type |
Default |
type |
String |
"" |
encoderOptions |
Dynamic |
(optional) |
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.
| Name |
Type |
Default |
callback |
Function |
|
type |
String |
"" |
encoderOptions |
Dynamic |
(optional) |
Returns a CanvasCaptureMediaStream that is a real-time video capture of the surface of the canvas.
| Name |
Type |
Default |
frameRate |
Float |
(optional) |
getContext2d(?attribs: AnonStruct): CanvasRenderingContext2D
Shorthand for getting a CanvasRenderingContext2D.
| Name |
Type |
Default |
attribs |
AnonStruct |
(optional) |
Shorthand for getting a js.html.webgl.RenderingContext.
Shorthand for getting a js.html.webgl.WebGL2RenderingContext.