The HTMLCanvasElement or OffscreenCanvas that is associated with the above context.
If there was no associated <canvas>
element, just store the default WIDTH / HEIGHT.
The 2D rendering context from the Canvas API. Forward method calls to this object.
Height of one line of text (in pixels).
Static
CANVAS_Static
CATEGORYStatic
HEIGHTStatic
WIDTHSet the pixels in a rectangular area to transparent black rgba(0,0,0,0).
Optional
cls: stringOptional
id: stringOptional
attrs: GroupAttributesOptional
devicePixelRatio: numberCanvasContext ignores setBackgroundFillStyle()
.
Optional
f: string | FontInfois 1) a FontInfo
object or
2) a string formatted as CSS font shorthand (e.g., 'bold 10pt Arial') or
3) a string representing the font family (one of size
, weight
, or style
must also be provided).
Optional
size: string | numbera string specifying the font size and unit (e.g., '16pt'), or a number (the unit is assumed to be 'pt').
Optional
weight: string | numberis a string (e.g., 'bold', 'normal') or a number (100, 200, ... 900).
Optional
style: stringis a string (e.g., 'italic', 'normal').
This is kept for backwards compatibility with 3.0.9.
use setFont(...)
instead since it now supports CSS font shorthand.
Static
sanitize
A rendering context for the Canvas backend. This class serves as a proxy for the underlying CanvasRenderingContext2D object, part of the browser's API.