Class: LeaferCanvas โ
Hierarchy โ
โณ
LeaferCanvas
Table of contents โ
Constructors โ
Properties โ
- view
- parentView
- resizeObserver
- autoBounds
- resizeListener
- context
- smooth
- smoothLevel
- opacity
- fillStyle
- strokeStyle
- strokeWidth
- strokeCap
- strokeJoin
- dashOffset
- miterLimit
- shadowBlur
- shadowColor
- shadowOffsetX
- shadowOffsetY
- filter
- font
- fontKerning
- fontStretch
- fontVariantCaps
- textAlign
- textBaseline
- textRendering
- wordSpacing
- letterSpacing
- direction
- innerId
- name
- manager
- size
- bounds
- clientBounds
- config
- autoLayout
- unreal
- recycled
- worldTransform
- savedBlendMode
Accessors โ
- zIndex
- childIndex
- backgroundColor
- hittable
- blendMode
- dashPattern
- width
- height
- pixelRatio
- pixelWidth
- pixelHeight
- allowBackgroundColor
Methods โ
- init
- __createView
- __createViewFrom
- setAbsolute
- updateViewSize
- updateClientBounds
- startAutoLayout
- imitateResizeObserver
- checkAutoBounds
- stopAutoLayout
- emitResize
- unrealCanvas
- destroy
- __bindContext
- setTransform
- resetTransform
- getTransform
- save
- restore
- transform
- translate
- scale
- rotate
- fill
- stroke
- clip
- fillRect
- strokeRect
- clearRect
- drawImage
- beginPath
- moveTo
- lineTo
- bezierCurveTo
- quadraticCurveTo
- closePath
- arc
- arcTo
- ellipse
- rect
- roundRect
- createConicGradient
- createLinearGradient
- createPattern
- createRadialGradient
- fillText
- measureText
- strokeText
- __createContext
- export
- toBlob
- toDataURL
- saveAs
- resize
- getClientBounds
- setCursor
- setWorld
- useWorldTransform
- setStroke
- setStrokeOptions
- saveBlendMode
- restoreBlendMode
- hitFill
- hitStroke
- hitPixel
- setWorldShadow
- setWorldBlur
- copyWorld
- copyWorldToInner
- copyWorldByReset
- useMask
- useEraser
- fillWorld
- strokeWorld
- clearWorld
- clipWorld
- clear
- isSameSize
- getSameCanvas
- recycle
- updateRender
Constructors โ
constructor โ
โข new LeaferCanvas(config?
, manager?
): LeaferCanvas
Parameters โ
Name | Type |
---|---|
config? | ILeaferCanvasConfig |
manager? | ICanvasManager |
Returns โ
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:51
Properties โ
view โ
โข view: HTMLCanvasElement
Overrides โ
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:9
parentView โ
โข parentView: HTMLElement
Overrides โ
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:10
resizeObserver โ
โข Protected
resizeObserver: ResizeObserver
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:31
autoBounds โ
โข Protected
autoBounds: IAutoBounds
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:32
resizeListener โ
โข Protected
resizeListener: IResizeEventListener
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:33
context โ
โข context: ICanvasContext2D
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:27
smooth โ
โข smooth: boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:32
smoothLevel โ
โข smoothLevel: ImageSmoothingQuality
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:35
opacity โ
โข opacity: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:38
fillStyle โ
โข fillStyle: string
| object
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:50
strokeStyle โ
โข strokeStyle: string
| object
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:53
strokeWidth โ
โข strokeWidth: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:57
strokeCap โ
โข strokeCap: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:60
strokeJoin โ
โข strokeJoin: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:63
dashOffset โ
โข dashOffset: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:73
miterLimit โ
โข miterLimit: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:76
shadowBlur โ
โข shadowBlur: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:80
shadowColor โ
โข shadowColor: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:83
shadowOffsetX โ
โข shadowOffsetX: number
Inherited from โ
LeaferCanvasBase.shadowOffsetX
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:86
shadowOffsetY โ
โข shadowOffsetY: number
Inherited from โ
LeaferCanvasBase.shadowOffsetY
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:89
filter โ
โข filter: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:92
font โ
โข font: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:96
fontKerning โ
โข fontKerning: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:99
fontStretch โ
โข fontStretch: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:102
fontVariantCaps โ
โข fontVariantCaps: string
Inherited from โ
LeaferCanvasBase.fontVariantCaps
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:105
textAlign โ
โข textAlign: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:109
textBaseline โ
โข textBaseline: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:112
textRendering โ
โข textRendering: string
Inherited from โ
LeaferCanvasBase.textRendering
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:115
wordSpacing โ
โข wordSpacing: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:118
letterSpacing โ
โข letterSpacing: string
Inherited from โ
LeaferCanvasBase.letterSpacing
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:121
direction โ
โข direction: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:125
innerId โ
โข Readonly
innerId: number
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:16
name โ
โข name: string
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:18
manager โ
โข manager: ICanvasManager
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:20
size โ
โข size: IScreenSizeData
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:22
bounds โ
โข bounds: IBounds
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:33
clientBounds โ
โข clientBounds: IBoundsData
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:34
config โ
โข config: ILeaferCanvasConfig
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:36
autoLayout โ
โข autoLayout: boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:38
unreal โ
โข Optional
unreal: boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:43
recycled โ
โข Optional
recycled: boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:45
worldTransform โ
โข worldTransform: IMatrixData
Inherited from โ
LeaferCanvasBase.worldTransform
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:47
savedBlendMode โ
โข Protected
savedBlendMode: IBlendMode
Inherited from โ
LeaferCanvasBase.savedBlendMode
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:49
Accessors โ
zIndex โ
โข set
zIndex(zIndex
): void
Parameters โ
Name | Type |
---|---|
zIndex | number |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:12
childIndex โ
โข set
childIndex(index
): void
Parameters โ
Name | Type |
---|---|
index | number |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:18
backgroundColor โ
โข get
backgroundColor(): string
Returns โ
string
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:60
โข set
backgroundColor(color
): void
Parameters โ
Name | Type |
---|---|
color | string |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:59
hittable โ
โข get
hittable(): boolean
Returns โ
boolean
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:63
โข set
hittable(hittable
): void
Parameters โ
Name | Type |
---|---|
hittable | boolean |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:62
blendMode โ
โข get
blendMode(): IBlendMode
Returns โ
Inherited from โ
LeaferCanvasBase.blendMode
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:45
โข set
blendMode(value
): void
Parameters โ
Name | Type |
---|---|
value | IBlendMode |
Returns โ
void
Inherited from โ
LeaferCanvasBase.blendMode
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:40
dashPattern โ
โข get
dashPattern(): number
[]
Returns โ
number
[]
Inherited from โ
LeaferCanvasBase.dashPattern
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:68
โข set
dashPattern(value
): void
Parameters โ
Name | Type |
---|---|
value | number [] |
Returns โ
void
Inherited from โ
LeaferCanvasBase.dashPattern
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:65
width โ
โข get
width(): number
Returns โ
number
Inherited from โ
LeaferCanvasBase.width
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:24
height โ
โข get
height(): number
Returns โ
number
Inherited from โ
LeaferCanvasBase.height
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:25
pixelRatio โ
โข get
pixelRatio(): number
Returns โ
number
Inherited from โ
LeaferCanvasBase.pixelRatio
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:27
pixelWidth โ
โข get
pixelWidth(): number
Returns โ
number
Inherited from โ
LeaferCanvasBase.pixelWidth
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:28
pixelHeight โ
โข get
pixelHeight(): number
Returns โ
number
Inherited from โ
LeaferCanvasBase.pixelHeight
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:29
allowBackgroundColor โ
โข get
allowBackgroundColor(): boolean
Returns โ
boolean
Inherited from โ
LeaferCanvasBase.allowBackgroundColor
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:31
Methods โ
init โ
โธ init(): void
Returns โ
void
Overrides โ
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:35
__createView โ
โธ __createView(): void
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:65
__createViewFrom โ
โธ __createViewFrom(inputView
): void
Parameters โ
Name | Type |
---|---|
inputView | string | object |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:69
setAbsolute โ
โธ setAbsolute(view
): void
Parameters โ
Name | Type |
---|---|
view | HTMLCanvasElement |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:104
updateViewSize โ
โธ updateViewSize(): void
Returns โ
void
Overrides โ
LeaferCanvasBase.updateViewSize
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:110
updateClientBounds โ
โธ updateClientBounds(): void
Returns โ
void
Overrides โ
LeaferCanvasBase.updateClientBounds
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:121
startAutoLayout โ
โธ startAutoLayout(autoBounds
, listener
): void
Parameters โ
Name | Type |
---|---|
autoBounds | IAutoBounds |
listener | IResizeEventListener |
Returns โ
void
Overrides โ
LeaferCanvasBase.startAutoLayout
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:125
imitateResizeObserver โ
โธ imitateResizeObserver(): void
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:169
checkAutoBounds โ
โธ checkAutoBounds(parentSize
): void
Parameters โ
Name | Type |
---|---|
parentSize | ISizeData |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:176
stopAutoLayout โ
โธ stopAutoLayout(): void
Returns โ
void
Overrides โ
LeaferCanvasBase.stopAutoLayout
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:188
emitResize โ
โธ emitResize(size
): void
Parameters โ
Name | Type |
---|---|
size | IScreenSizeData |
Returns โ
void
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:197
unrealCanvas โ
โธ unrealCanvas(): void
Returns โ
void
Overrides โ
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:205
destroy โ
โธ destroy(): void
Returns โ
void
Overrides โ
Defined in โ
leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:215
__bindContext โ
โธ __bindContext(): void
Returns โ
void
Inherited from โ
LeaferCanvasBase.__bindContext
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:129
setTransform โ
โธ setTransform(_a
, _b?
, _c?
, _d?
, _e?
, _f?
): void
Parameters โ
Name | Type |
---|---|
_a | number | IMatrixData |
_b? | number |
_c? | number |
_d? | number |
_e? | number |
_f? | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:141
resetTransform โ
โธ resetTransform(): void
Returns โ
void
Inherited from โ
LeaferCanvasBase.resetTransform
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:144
getTransform โ
โธ getTransform(): IMatrixData
Returns โ
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:147
save โ
โธ save(): void
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:150
restore โ
โธ restore(): void
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:153
transform โ
โธ transform(a
, b?
, c?
, d?
, e?
, f?
): void
Parameters โ
Name | Type |
---|---|
a | number | IMatrixData |
b? | number |
c? | number |
d? | number |
e? | number |
f? | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:155
translate โ
โธ translate(_x
, _y
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:164
scale โ
โธ scale(_x
, _y
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:167
rotate โ
โธ rotate(_angle
): void
Parameters โ
Name | Type |
---|---|
_angle | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:170
fill โ
โธ fill(_path2d?
, _rule?
): void
Parameters โ
Name | Type |
---|---|
_path2d? | IWindingRule | IPath2D |
_rule? | IWindingRule |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:173
stroke โ
โธ stroke(_path2d?
): void
Parameters โ
Name | Type |
---|---|
_path2d? | IPath2D |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:176
clip โ
โธ clip(_path2d?
, _rule?
): void
Parameters โ
Name | Type |
---|---|
_path2d? | IWindingRule | IPath2D |
_rule? | IWindingRule |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:179
fillRect โ
โธ fillRect(_x
, _y
, _width
, _height
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
_width | number |
_height | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:182
strokeRect โ
โธ strokeRect(_x
, _y
, _width
, _height
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
_width | number |
_height | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:185
clearRect โ
โธ clearRect(_x
, _y
, _width
, _height
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
_width | number |
_height | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:188
drawImage โ
โธ drawImage(image
, sx
, sy
, sw?
, sh?
, dx?
, dy?
, dw?
, dh?
): void
Parameters โ
Name | Type |
---|---|
image | CanvasImageSource |
sx | number |
sy | number |
sw? | number |
sh? | number |
dx? | number |
dy? | number |
dw? | number |
dh? | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:190
beginPath โ
โธ beginPath(): void
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:224
moveTo โ
โธ moveTo(_x
, _y
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:227
lineTo โ
โธ lineTo(_x
, _y
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:230
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 โ
LeaferCanvasBase.bezierCurveTo
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:233
quadraticCurveTo โ
โธ quadraticCurveTo(_cpx
, _cpy
, _x
, _y
): void
Parameters โ
Name | Type |
---|---|
_cpx | number |
_cpy | number |
_x | number |
_y | number |
Returns โ
void
Inherited from โ
LeaferCanvasBase.quadraticCurveTo
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:236
closePath โ
โธ closePath(): void
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:239
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 โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:242
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 โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:245
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 โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:248
rect โ
โธ rect(_x
, _y
, _width
, _height
): void
Parameters โ
Name | Type |
---|---|
_x | number |
_y | number |
_width | number |
_height | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:251
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 โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:254
createConicGradient โ
โธ createConicGradient(_startAngle
, _x
, _y
): CanvasGradient
Parameters โ
Name | Type |
---|---|
_startAngle | number |
_x | number |
_y | number |
Returns โ
CanvasGradient
Inherited from โ
LeaferCanvasBase.createConicGradient
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:261
createLinearGradient โ
โธ createLinearGradient(_x0
, _y0
, _x1
, _y1
): CanvasGradient
Parameters โ
Name | Type |
---|---|
_x0 | number |
_y0 | number |
_x1 | number |
_y1 | number |
Returns โ
CanvasGradient
Inherited from โ
LeaferCanvasBase.createLinearGradient
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:264
createPattern โ
โธ createPattern(_image
, _repetition
): CanvasPattern
Parameters โ
Name | Type |
---|---|
_image | CanvasImageSource |
_repetition | string |
Returns โ
CanvasPattern
Inherited from โ
LeaferCanvasBase.createPattern
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:267
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 โ
LeaferCanvasBase.createRadialGradient
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:270
fillText โ
โธ fillText(_text
, _x
, _y
, _maxWidth?
): void
Parameters โ
Name | Type |
---|---|
_text | string |
_x | number |
_y | number |
_maxWidth? | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:274
measureText โ
โธ measureText(_text
): ITextMetrics
Parameters โ
Name | Type |
---|---|
_text | string |
Returns โ
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:277
strokeText โ
โธ strokeText(_text
, _x
, _y
, _maxWidth?
): void
Parameters โ
Name | Type |
---|---|
_text | string |
_x | number |
_y | number |
_maxWidth? | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/Canvas.ts:280
__createContext โ
โธ __createContext(): void
Returns โ
void
Inherited from โ
LeaferCanvasBase.__createContext
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:70
export โ
โธ export(_filename
, _options?
): string
| Promise
<any
>
Parameters โ
Name | Type |
---|---|
_filename | string |
_options? | number | boolean | IExportOptions |
Returns โ
string
| Promise
<any
>
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:79
toBlob โ
โธ toBlob(_type?
, _quality?
): Promise
<any
>
Parameters โ
Name | Type |
---|---|
_type? | IExportFileType |
_quality? | number |
Returns โ
Promise
<any
>
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:81
toDataURL โ
โธ toDataURL(_type?
, _quality?
): string
| Promise
<string
>
Parameters โ
Name | Type |
---|---|
_type? | IExportImageType |
_quality? | number |
Returns โ
string
| Promise
<string
>
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:83
saveAs โ
โธ saveAs(_filename
, _quality?
): Promise
<boolean
>
Parameters โ
Name | Type |
---|---|
_filename | string |
_quality? | number |
Returns โ
Promise
<boolean
>
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:85
resize โ
โธ resize(size
): void
Parameters โ
Name | Type |
---|---|
size | IScreenSizeData |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:89
getClientBounds โ
โธ getClientBounds(update?
): IBoundsData
Parameters โ
Name | Type |
---|---|
update? | boolean |
Returns โ
Inherited from โ
LeaferCanvasBase.getClientBounds
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:119
setCursor โ
โธ setCursor(_cursor
): void
Parameters โ
Name | Type |
---|---|
_cursor | ICursorType | ICursorType [] |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:127
setWorld โ
โธ setWorld(matrix
, parentMatrix?
): void
Parameters โ
Name | Type |
---|---|
matrix | IMatrixData |
parentMatrix? | IMatrixData |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:129
useWorldTransform โ
โธ useWorldTransform(worldTransform?
): void
Parameters โ
Name | Type |
---|---|
worldTransform? | IMatrixData |
Returns โ
void
Inherited from โ
LeaferCanvasBase.useWorldTransform
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:157
setStroke โ
โธ setStroke(color
, strokeWidth
, options?
): void
Parameters โ
Name | Type |
---|---|
color | string | object |
strokeWidth | number |
options? | ICanvasStrokeOptions |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:163
setStrokeOptions โ
โธ setStrokeOptions(options
): void
Parameters โ
Name | Type |
---|---|
options | ICanvasStrokeOptions |
Returns โ
void
Inherited from โ
LeaferCanvasBase.setStrokeOptions
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:169
saveBlendMode โ
โธ saveBlendMode(blendMode
): void
Parameters โ
Name | Type |
---|---|
blendMode | IBlendMode |
Returns โ
void
Inherited from โ
LeaferCanvasBase.saveBlendMode
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:177
restoreBlendMode โ
โธ restoreBlendMode(): void
Returns โ
void
Inherited from โ
LeaferCanvasBase.restoreBlendMode
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:182
hitFill โ
โธ hitFill(_point
, _fillRule?
): boolean
Parameters โ
Name | Type |
---|---|
_point | IPointData |
_fillRule? | IWindingRule |
Returns โ
boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:188
hitStroke โ
โธ hitStroke(_point
, _strokeWidth?
): boolean
Parameters โ
Name | Type |
---|---|
_point | IPointData |
_strokeWidth? | number |
Returns โ
boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:190
hitPixel โ
โธ hitPixel(_radiusPoint
, _offset?
, _scale?
): boolean
Parameters โ
Name | Type | Default value |
---|---|---|
_radiusPoint | IRadiusPointData | undefined |
_offset? | IPointData | undefined |
_scale | number | 1 |
Returns โ
boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:192
setWorldShadow โ
โธ setWorldShadow(x
, y
, blur
, color?
): void
Parameters โ
Name | Type |
---|---|
x | number |
y | number |
blur | number |
color? | string |
Returns โ
void
Inherited from โ
LeaferCanvasBase.setWorldShadow
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:196
setWorldBlur โ
โธ setWorldBlur(blur
): void
Parameters โ
Name | Type |
---|---|
blur | number |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:204
copyWorld โ
โธ copyWorld(canvas
, from?
, to?
, blendMode?
): void
Parameters โ
Name | Type |
---|---|
canvas | ILeaferCanvas |
from? | IBoundsData |
to? | IBoundsData |
blendMode? | IBlendMode |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:210
copyWorldToInner โ
โธ copyWorldToInner(canvas
, fromWorld
, toInnerBounds
, blendMode?
): void
Parameters โ
Name | Type |
---|---|
canvas | ILeaferCanvas |
fromWorld | IMatrixWithBoundsData |
toInnerBounds | IBoundsData |
blendMode? | IBlendMode |
Returns โ
void
Inherited from โ
LeaferCanvasBase.copyWorldToInner
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:222
copyWorldByReset โ
โธ copyWorldByReset(canvas
, from?
, to?
, blendMode?
, onlyResetTransform?
): void
Parameters โ
Name | Type |
---|---|
canvas | ILeaferCanvas |
from? | IBoundsData |
to? | IBoundsData |
blendMode? | IBlendMode |
onlyResetTransform? | boolean |
Returns โ
void
Inherited from โ
LeaferCanvasBase.copyWorldByReset
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:236
useMask โ
โธ useMask(maskCanvas
, fromBounds?
, toBounds?
): void
Parameters โ
Name | Type |
---|---|
maskCanvas | ILeaferCanvas |
fromBounds? | IBoundsData |
toBounds? | IBoundsData |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:242
useEraser โ
โธ useEraser(eraserCanvas
, fromBounds?
, toBounds?
): void
Parameters โ
Name | Type |
---|---|
eraserCanvas | ILeaferCanvas |
fromBounds? | IBoundsData |
toBounds? | IBoundsData |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:246
fillWorld โ
โธ fillWorld(bounds
, color
, blendMode?
): void
Parameters โ
Name | Type |
---|---|
bounds | IBoundsData |
color | string | object |
blendMode? | IBlendMode |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:250
strokeWorld โ
โธ strokeWorld(bounds
, color
, blendMode?
): void
Parameters โ
Name | Type |
---|---|
bounds | IBoundsData |
color | string | object |
blendMode? | IBlendMode |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:258
clearWorld โ
โธ clearWorld(bounds
, ceilPixel?
): void
Parameters โ
Name | Type |
---|---|
bounds | IBoundsData |
ceilPixel? | boolean |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:266
clipWorld โ
โธ clipWorld(bounds
, ceilPixel?
): void
Parameters โ
Name | Type |
---|---|
bounds | IBoundsData |
ceilPixel? | boolean |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:272
clear โ
โธ clear(): void
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:281
isSameSize โ
โธ isSameSize(size
): boolean
Parameters โ
Name | Type |
---|---|
size | IScreenSizeData |
Returns โ
boolean
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:289
getSameCanvas โ
โธ getSameCanvas(useSameWorldTransform?
, useSameSmooth?
): ILeaferCanvas
Parameters โ
Name | Type |
---|---|
useSameWorldTransform? | boolean |
useSameSmooth? | boolean |
Returns โ
Inherited from โ
LeaferCanvasBase.getSameCanvas
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:294
recycle โ
โธ recycle(clearBounds?
): void
Parameters โ
Name | Type |
---|---|
clearBounds? | IBoundsData |
Returns โ
void
Inherited from โ
Defined in โ
leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:305
updateRender โ
โธ updateRender(_bounds?
): void
Parameters โ
Name | Type |
---|---|
_bounds? | IBoundsData |
Returns โ
void