CanvasElement Interface
HTMLCanvasElement
interface, which provides properties and methods for manipulating the layout and presentation of canvas elements. The HTMLCanvasElement
interface inherits the properties and methods of the element
object interface.
Extends
Constructors
Methods
Code Object getContext(String contextId) #
CanvasRenderingContext2D
Object, whereas calling it with "experimental-webgl" returns a WebGLRenderingContext
Object.
Object getContext(String contextId);
Code String toDataURL(String type) #
Returns a data:
URL containing a representation of the image in the format specified by type
(defaults to PNG).
- If the height or width of the canvas is 0,
"data:,
" representing the empty string, is returned. - If the type requested is not
image/png
, and the returned value starts withdata:image/png
, then the requested type is not supported. - Chrome supports the
image/webp
type. - If the requested type is
image/jpeg
orimage/webp
, then the second argument, if it is between 0.0 and 1.0, is treated as indicating image quality; if the second argument is anything else, the default value for image quality is used. Other arguments are ignored.
String toDataURL(String type);
Fields
Code final CanvasRenderingContext2D context2d #
final CanvasRenderingContext2D context2d;
This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.