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