Interface: ICanvasContext2D â
Hierarchy â
CanvasCompositing
CanvasDrawImage
CanvasDrawPath
CanvasFillStrokeStyles
CanvasFilters
CanvasImageData
CanvasImageSmoothing
CanvasPath
CanvasPathDrawingStyles
CanvasRect
CanvasShadowStyles
CanvasState
CanvasText
CanvasTextDrawingStyles
CanvasTransform
CanvasUserInterface
âł
ICanvasContext2D
Table of contents â
Properties â
- globalAlpha
- globalCompositeOperation
- fillStyle
- strokeStyle
- filter
- imageSmoothingEnabled
- imageSmoothingQuality
- lineCap
- lineDashOffset
- lineJoin
- lineWidth
- miterLimit
- canvas
- shadowBlur
- shadowColor
- shadowOffsetX
- shadowOffsetY
- direction
- font
- textAlign
- textBaseline
Methods â
- drawImage
- beginPath
- clip
- fill
- isPointInPath
- isPointInStroke
- stroke
- createConicGradient
- createLinearGradient
- createPattern
- createRadialGradient
- createImageData
- getImageData
- putImageData
- arc
- arcTo
- bezierCurveTo
- closePath
- ellipse
- lineTo
- moveTo
- quadraticCurveTo
- rect
- roundRect
- getLineDash
- setLineDash
- clearRect
- fillRect
- strokeRect
- getContextAttributes
- restore
- save
- drawFocusIfNeeded
- fillText
- measureText
- strokeText
- getTransform
- resetTransform
- rotate
- scale
- setTransform
- transform
- translate
Properties â
globalAlpha â
⢠globalAlpha: number
Inherited from â
CanvasCompositing.globalAlpha
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:23
globalCompositeOperation â
⢠globalCompositeOperation: GlobalCompositeOperation
Inherited from â
CanvasCompositing.globalCompositeOperation
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:24
fillStyle â
⢠fillStyle: string
| CanvasGradient
| CanvasPattern
Inherited from â
CanvasFillStrokeStyles.fillStyle
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:49
strokeStyle â
⢠strokeStyle: string
| CanvasGradient
| CanvasPattern
Inherited from â
CanvasFillStrokeStyles.strokeStyle
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:50
filter â
⢠filter: string
Inherited from â
CanvasFilters.filter
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:58
imageSmoothingEnabled â
⢠imageSmoothingEnabled: boolean
Inherited from â
CanvasImageSmoothing.imageSmoothingEnabled
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:83
imageSmoothingQuality â
⢠imageSmoothingQuality: ImageSmoothingQuality
Inherited from â
CanvasImageSmoothing.imageSmoothingQuality
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:84
lineCap â
⢠lineCap: CanvasLineCap
Inherited from â
CanvasPathDrawingStyles.lineCap
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:101
lineDashOffset â
⢠lineDashOffset: number
Inherited from â
CanvasPathDrawingStyles.lineDashOffset
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:102
lineJoin â
⢠lineJoin: CanvasLineJoin
Inherited from â
CanvasPathDrawingStyles.lineJoin
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:103
lineWidth â
⢠lineWidth: number
Inherited from â
CanvasPathDrawingStyles.lineWidth
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:104
miterLimit â
⢠miterLimit: number
Inherited from â
CanvasPathDrawingStyles.miterLimit
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:105
canvas â
⢠Readonly
canvas: HTMLCanvasElement
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:138
shadowBlur â
⢠shadowBlur: number
Inherited from â
CanvasShadowStyles.shadowBlur
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:148
shadowColor â
⢠shadowColor: string
Inherited from â
CanvasShadowStyles.shadowColor
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:149
shadowOffsetX â
⢠shadowOffsetX: number
Inherited from â
CanvasShadowStyles.shadowOffsetX
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:150
shadowOffsetY â
⢠shadowOffsetY: number
Inherited from â
CanvasShadowStyles.shadowOffsetY
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:151
direction â
⢠direction: CanvasDirection
Inherited from â
CanvasTextDrawingStyles.direction
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:194
font â
⢠font: string
Inherited from â
CanvasTextDrawingStyles.font
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:195
textAlign â
⢠textAlign: CanvasTextAlign
Inherited from â
CanvasTextDrawingStyles.textAlign
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:196
textBaseline â
⢠textBaseline: CanvasTextBaseline
Inherited from â
CanvasTextDrawingStyles.textBaseline
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:197
Methods â
drawImage â
⸠drawImage(image
, dx
, dy
): void
Parameters â
Name | Type |
---|---|
image | any |
dx | number |
dy | number |
Returns â
void
Inherited from â
CanvasDrawImage.drawImage
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:29
⸠drawImage(image
, dx
, dy
, dw
, dh
): void
Parameters â
Name | Type |
---|---|
image | any |
dx | number |
dy | number |
dw | number |
dh | number |
Returns â
void
Inherited from â
CanvasDrawImage.drawImage
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:30
⸠drawImage(image
, sx
, sy
, sw
, sh
, dx
, dy
, dw
, dh
): void
Parameters â
Name | Type |
---|---|
image | any |
sx | number |
sy | number |
sw | number |
sh | number |
dx | number |
dy | number |
dw | number |
dh | number |
Returns â
void
Inherited from â
CanvasDrawImage.drawImage
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:31
beginPath â
⸠beginPath(): void
Returns â
void
Inherited from â
CanvasDrawPath.beginPath
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:35
clip â
⸠clip(fillRule?
): void
Parameters â
Name | Type |
---|---|
fillRule? | IWindingRule |
Returns â
void
Inherited from â
CanvasDrawPath.clip
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:36
⸠clip(path
, fillRule?
): void
Parameters â
Name | Type |
---|---|
path | IPath2D |
fillRule? | IWindingRule |
Returns â
void
Inherited from â
CanvasDrawPath.clip
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:37
fill â
⸠fill(fillRule?
): void
Parameters â
Name | Type |
---|---|
fillRule? | IWindingRule |
Returns â
void
Inherited from â
CanvasDrawPath.fill
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:38
⸠fill(path
, fillRule?
): void
Parameters â
Name | Type |
---|---|
path | IPath2D |
fillRule? | IWindingRule |
Returns â
void
Inherited from â
CanvasDrawPath.fill
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:39
isPointInPath â
⸠isPointInPath(x
, y
, fillRule?
): boolean
Parameters â
Name | Type |
---|---|
x | number |
y | number |
fillRule? | IWindingRule |
Returns â
boolean
Inherited from â
CanvasDrawPath.isPointInPath
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:40
⸠isPointInPath(path
, x
, y
, fillRule?
): boolean
Parameters â
Name | Type |
---|---|
path | IPath2D |
x | number |
y | number |
fillRule? | IWindingRule |
Returns â
boolean
Inherited from â
CanvasDrawPath.isPointInPath
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:41
isPointInStroke â
⸠isPointInStroke(x
, y
): boolean
Parameters â
Name | Type |
---|---|
x | number |
y | number |
Returns â
boolean
Inherited from â
CanvasDrawPath.isPointInStroke
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:42
⸠isPointInStroke(path
, x
, y
): boolean
Parameters â
Name | Type |
---|---|
path | IPath2D |
x | number |
y | number |
Returns â
boolean
Inherited from â
CanvasDrawPath.isPointInStroke
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:43
stroke â
⸠stroke(): void
Returns â
void
Inherited from â
CanvasDrawPath.stroke
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:44
⸠stroke(path
): void
Parameters â
Name | Type |
---|---|
path | IPath2D |
Returns â
void
Inherited from â
CanvasDrawPath.stroke
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:45
createConicGradient â
⸠createConicGradient(startAngle
, x
, y
): CanvasGradient
Parameters â
Name | Type |
---|---|
startAngle | number |
x | number |
y | number |
Returns â
CanvasGradient
Inherited from â
CanvasFillStrokeStyles.createConicGradient
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:51
createLinearGradient â
⸠createLinearGradient(x0
, y0
, x1
, y1
): CanvasGradient
Parameters â
Name | Type |
---|---|
x0 | number |
y0 | number |
x1 | number |
y1 | number |
Returns â
CanvasGradient
Inherited from â
CanvasFillStrokeStyles.createLinearGradient
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:52
createPattern â
⸠createPattern(image
, repetition
): CanvasPattern
Parameters â
Name | Type |
---|---|
image | any |
repetition | string |
Returns â
CanvasPattern
Inherited from â
CanvasFillStrokeStyles.createPattern
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:53
createRadialGradient â
⸠createRadialGradient(x0
, y0
, r0
, x1
, y1
, r1
): CanvasGradient
Parameters â
Name | Type |
---|---|
x0 | number |
y0 | number |
r0 | number |
x1 | number |
y1 | number |
r1 | number |
Returns â
CanvasGradient
Inherited from â
CanvasFillStrokeStyles.createRadialGradient
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:54
createImageData â
⸠createImageData(sw
, sh
, settings?
): ImageData
Parameters â
Name | Type |
---|---|
sw | number |
sh | number |
settings? | ImageDataSettings |
Returns â
ImageData
Inherited from â
CanvasImageData.createImageData
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:75
⸠createImageData(imagedata
): ImageData
Parameters â
Name | Type |
---|---|
imagedata | ImageData |
Returns â
ImageData
Inherited from â
CanvasImageData.createImageData
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:76
getImageData â
⸠getImageData(sx
, sy
, sw
, sh
, settings?
): ImageData
Parameters â
Name | Type |
---|---|
sx | number |
sy | number |
sw | number |
sh | number |
settings? | ImageDataSettings |
Returns â
ImageData
Inherited from â
CanvasImageData.getImageData
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:77
putImageData â
⸠putImageData(imagedata
, dx
, dy
): void
Parameters â
Name | Type |
---|---|
imagedata | ImageData |
dx | number |
dy | number |
Returns â
void
Inherited from â
CanvasImageData.putImageData
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:78
⸠putImageData(imagedata
, dx
, dy
, dirtyX
, dirtyY
, dirtyWidth
, dirtyHeight
): void
Parameters â
Name | Type |
---|---|
imagedata | ImageData |
dx | number |
dy | number |
dirtyX | number |
dirtyY | number |
dirtyWidth | number |
dirtyHeight | number |
Returns â
void
Inherited from â
CanvasImageData.putImageData
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:79
arc â
⸠arc(x
, y
, radius
, startAngle
, endAngle
, anticlockwise?
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
radius | number |
startAngle | number |
endAngle | number |
anticlockwise? | boolean |
Returns â
void
Inherited from â
CanvasPath.arc
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:88
arcTo â
⸠arcTo(x1
, y1
, x2
, y2
, radius
): void
Parameters â
Name | Type |
---|---|
x1 | number |
y1 | number |
x2 | number |
y2 | number |
radius | number |
Returns â
void
Inherited from â
CanvasPath.arcTo
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:89
bezierCurveTo â
⸠bezierCurveTo(cp1x
, cp1y
, cp2x
, cp2y
, x
, y
): void
Parameters â
Name | Type |
---|---|
cp1x | number |
cp1y | number |
cp2x | number |
cp2y | number |
x | number |
y | number |
Returns â
void
Inherited from â
CanvasPath.bezierCurveTo
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:90
closePath â
⸠closePath(): void
Returns â
void
Inherited from â
CanvasPath.closePath
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:91
ellipse â
⸠ellipse(x
, y
, radiusX
, radiusY
, rotation
, startAngle
, endAngle
, anticlockwise?
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
radiusX | number |
radiusY | number |
rotation | number |
startAngle | number |
endAngle | number |
anticlockwise? | boolean |
Returns â
void
Inherited from â
CanvasPath.ellipse
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:92
lineTo â
⸠lineTo(x
, y
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
Returns â
void
Inherited from â
CanvasPath.lineTo
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:93
moveTo â
⸠moveTo(x
, y
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
Returns â
void
Inherited from â
CanvasPath.moveTo
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:94
quadraticCurveTo â
⸠quadraticCurveTo(cpx
, cpy
, x
, y
): void
Parameters â
Name | Type |
---|---|
cpx | number |
cpy | number |
x | number |
y | number |
Returns â
void
Inherited from â
CanvasPath.quadraticCurveTo
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:95
rect â
⸠rect(x
, y
, w
, h
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
w | number |
h | number |
Returns â
void
Inherited from â
CanvasPath.rect
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:96
roundRect â
⸠roundRect(x
, y
, width
, height
, radius?
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
width | number |
height | number |
radius? | number | number [] |
Returns â
void
Inherited from â
CanvasPath.roundRect
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:97
getLineDash â
⸠getLineDash(): number
[]
Returns â
number
[]
Inherited from â
CanvasPathDrawingStyles.getLineDash
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:106
setLineDash â
⸠setLineDash(segments
): void
Parameters â
Name | Type |
---|---|
segments | number [] |
Returns â
void
Inherited from â
CanvasPathDrawingStyles.setLineDash
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:107
clearRect â
⸠clearRect(x
, y
, w
, h
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
w | number |
h | number |
Returns â
void
Inherited from â
CanvasRect.clearRect
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:122
fillRect â
⸠fillRect(x
, y
, w
, h
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
w | number |
h | number |
Returns â
void
Inherited from â
CanvasRect.fillRect
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:123
strokeRect â
⸠strokeRect(x
, y
, w
, h
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
w | number |
h | number |
Returns â
void
Inherited from â
CanvasRect.strokeRect
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:124
getContextAttributes â
⸠getContextAttributes(): ICanvasRenderingContext2DSettings
Returns â
ICanvasRenderingContext2DSettings
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:139
restore â
⸠restore(): void
Returns â
void
Inherited from â
CanvasState.restore
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:155
save â
⸠save(): void
Returns â
void
Inherited from â
CanvasState.save
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:156
drawFocusIfNeeded â
⸠drawFocusIfNeeded(element
): void
Parameters â
Name | Type |
---|---|
element | any |
Returns â
void
Inherited from â
CanvasUserInterface.drawFocusIfNeeded
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:160
⸠drawFocusIfNeeded(path
, element
): void
Parameters â
Name | Type |
---|---|
path | IPath2D |
element | any |
Returns â
void
Inherited from â
CanvasUserInterface.drawFocusIfNeeded
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:161
fillText â
⸠fillText(text
, x
, y
, maxWidth?
): void
Parameters â
Name | Type |
---|---|
text | string |
x | number |
y | number |
maxWidth? | number |
Returns â
void
Inherited from â
CanvasText.fillText
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:188
measureText â
⸠measureText(text
): ITextMetrics
Parameters â
Name | Type |
---|---|
text | string |
Returns â
Inherited from â
CanvasText.measureText
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:189
strokeText â
⸠strokeText(text
, x
, y
, maxWidth?
): void
Parameters â
Name | Type |
---|---|
text | string |
x | number |
y | number |
maxWidth? | number |
Returns â
void
Inherited from â
CanvasText.strokeText
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:190
getTransform â
⸠getTransform(): DOMMatrix
Returns â
DOMMatrix
Inherited from â
CanvasTransform.getTransform
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:201
resetTransform â
⸠resetTransform(): void
Returns â
void
Inherited from â
CanvasTransform.resetTransform
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:202
rotate â
⸠rotate(angle
): void
Parameters â
Name | Type |
---|---|
angle | number |
Returns â
void
Inherited from â
CanvasTransform.rotate
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:203
scale â
⸠scale(x
, y
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
Returns â
void
Inherited from â
CanvasTransform.scale
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:204
setTransform â
⸠setTransform(a
, b
, c
, d
, e
, f
): void
Parameters â
Name | Type |
---|---|
a | number |
b | number |
c | number |
d | number |
e | number |
f | number |
Returns â
void
Inherited from â
CanvasTransform.setTransform
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:205
⸠setTransform(transform?
): void
Parameters â
Name | Type |
---|---|
transform? | DOMMatrix2DInit |
Returns â
void
Inherited from â
CanvasTransform.setTransform
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:206
transform â
⸠transform(a
, b
, c
, d
, e
, f
): void
Parameters â
Name | Type |
---|---|
a | number |
b | number |
c | number |
d | number |
e | number |
f | number |
Returns â
void
Inherited from â
CanvasTransform.transform
Defined in â
leafer/packages/interface/src/canvas/ICanvas.ts:207
translate â
⸠translate(x
, y
): void
Parameters â
Name | Type |
---|---|
x | number |
y | number |
Returns â
void
Inherited from â
CanvasTransform.translate