AdvancedOptionaladdAdds the listener for the specified event.
Height of the canvas.
Optional ReadonlyparentParent node of the canvas.
OptionalremoveRemoves the listener for the specified event.
Optional ReadonlystyleStyle of the canvas.
Width of the canvas.
OptionalconvertGet the content of the canvas as Blob.
Optionaloptions: { quality?: number; type?: string }The options for creating Blob.
Optionalquality?: numberA number between 0 and 1 indicating the image quality to be used when
creating images using file formats that support lossy compression (such as image/jpeg or image/webp).
A user agent will use its default quality value if this option is not specified, or if the number
is outside the allowed range.
Optionaltype?: stringA string indicating the image format. The default type is image/png;
that type is also used if the given type isn't supported.
A Promise returning a Blob object representing the image contained in the canvas.
Dispatches a event.
The Event object to dispatch. Its Event.target property will be set to the current EventTarget.
Returns false if event is cancelable, and at least one of the event handlers which received event called Event.preventDefault(). Otherwise true.
OptionalgetGet the position and the size of the canvas.
The smallest rectangle which contains the entire canvas.
Get rendering context of the canvas.
The identifier of the type of context to create.
Optionaloptions: ICanvasRenderingContext2DSettingsThe options for creating context.
The created context, or null if contextId is not supported.
Optionaloptions: ImageBitmapRenderingContextSettingsOptionaloptions: WebGLContextAttributesOptionaloptions: WebGLContextAttributesOptionaloptions: ContextSettingsOptionaltoCreates a Blob from the content of the canvas.
A callback function with the resulting Blob object
as a single argument. null may be passed if the image cannot be created for any reason.
Optionaltype: stringA string indicating the image format. The default type is image/png;
that type is also used if the given type isn't supported.
Optionalquality: numberA number between 0 and 1 indicating the image quality to be used when
creating images using file formats that support lossy compression (such as image/jpeg or image/webp).
A user agent will use its default quality value if this option is not specified, or if the number
is outside the allowed range.
OptionaltoGet the content of the canvas as data URL.
Optionaltype: stringA string indicating the image format. The default type is image/png;
that type is also used if the given type isn't supported.
Optionalquality: numberA number between 0 and 1 indicating the image quality to be used when
creating images using file formats that support lossy compression (such as image/jpeg or image/webp).
A user agent will use its default quality value if this option is not specified, or if the number
is outside the allowed range.
A string containing the requested data URL.
Common interface for HTMLCanvasElement, OffscreenCanvas, and other custom canvas classes.