Skip to content

Class: LeaferCanvas ​

Hierarchy ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new LeaferCanvas(config?, manager?): LeaferCanvas

Parameters ​

NameType
config?ILeaferCanvasConfig
manager?ICanvasManager

Returns ​

LeaferCanvas

Inherited from ​

LeaferCanvasBase.constructor

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:51

Properties ​

view ​

• view: HTMLCanvasElement

Overrides ​

LeaferCanvasBase.view

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:9


parentView ​

• parentView: HTMLElement

Overrides ​

LeaferCanvasBase.parentView

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 ​

LeaferCanvasBase.context

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:27


smooth ​

• smooth: boolean

Inherited from ​

LeaferCanvasBase.smooth

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:32


smoothLevel ​

• smoothLevel: ImageSmoothingQuality

Inherited from ​

LeaferCanvasBase.smoothLevel

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:35


opacity ​

• opacity: number

Inherited from ​

LeaferCanvasBase.opacity

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:38


fillStyle ​

• fillStyle: string | object

Inherited from ​

LeaferCanvasBase.fillStyle

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:50


strokeStyle ​

• strokeStyle: string | object

Inherited from ​

LeaferCanvasBase.strokeStyle

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:53


strokeWidth ​

• strokeWidth: number

Inherited from ​

LeaferCanvasBase.strokeWidth

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:57


strokeCap ​

• strokeCap: string

Inherited from ​

LeaferCanvasBase.strokeCap

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:60


strokeJoin ​

• strokeJoin: string

Inherited from ​

LeaferCanvasBase.strokeJoin

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:63


dashOffset ​

• dashOffset: number

Inherited from ​

LeaferCanvasBase.dashOffset

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:73


miterLimit ​

• miterLimit: number

Inherited from ​

LeaferCanvasBase.miterLimit

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:76


shadowBlur ​

• shadowBlur: number

Inherited from ​

LeaferCanvasBase.shadowBlur

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:80


shadowColor ​

• shadowColor: string

Inherited from ​

LeaferCanvasBase.shadowColor

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 ​

LeaferCanvasBase.filter

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:92


font ​

• font: string

Inherited from ​

LeaferCanvasBase.font

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:96


fontKerning ​

• fontKerning: string

Inherited from ​

LeaferCanvasBase.fontKerning

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:99


fontStretch ​

• fontStretch: string

Inherited from ​

LeaferCanvasBase.fontStretch

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 ​

LeaferCanvasBase.textAlign

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:109


textBaseline ​

• textBaseline: string

Inherited from ​

LeaferCanvasBase.textBaseline

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 ​

LeaferCanvasBase.wordSpacing

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 ​

LeaferCanvasBase.direction

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:125


innerId ​

• Readonly innerId: number

Inherited from ​

LeaferCanvasBase.innerId

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:16


name ​

• name: string

Inherited from ​

LeaferCanvasBase.name

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:18


manager ​

• manager: ICanvasManager

Inherited from ​

LeaferCanvasBase.manager

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:20


size ​

• size: IScreenSizeData

Inherited from ​

LeaferCanvasBase.size

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:22


bounds ​

• bounds: IBounds

Inherited from ​

LeaferCanvasBase.bounds

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:33


clientBounds ​

• clientBounds: IBoundsData

Inherited from ​

LeaferCanvasBase.clientBounds

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:34


config ​

• config: ILeaferCanvasConfig

Inherited from ​

LeaferCanvasBase.config

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:36


autoLayout ​

• autoLayout: boolean

Inherited from ​

LeaferCanvasBase.autoLayout

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:38


unreal ​

• Optional unreal: boolean

Inherited from ​

LeaferCanvasBase.unreal

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:43


recycled ​

• Optional recycled: boolean

Inherited from ​

LeaferCanvasBase.recycled

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 ​

NameType
zIndexnumber

Returns ​

void

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:12


childIndex ​

• set childIndex(index): void

Parameters ​

NameType
indexnumber

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 ​

NameType
colorstring

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 ​

NameType
hittableboolean

Returns ​

void

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:62


blendMode ​

• get blendMode(): IBlendMode

Returns ​

IBlendMode

Inherited from ​

LeaferCanvasBase.blendMode

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:45

• set blendMode(value): void

Parameters ​

NameType
valueIBlendMode

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 ​

NameType
valuenumber[]

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 ​

LeaferCanvasBase.init

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 ​

NameType
inputViewstring | object

Returns ​

void

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:69


setAbsolute ​

▸ setAbsolute(view): void

Parameters ​

NameType
viewHTMLCanvasElement

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 ​

NameType
autoBoundsIAutoBounds
listenerIResizeEventListener

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 ​

NameType
parentSizeISizeData

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 ​

NameType
sizeIScreenSizeData

Returns ​

void

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:197


unrealCanvas ​

▸ unrealCanvas(): void

Returns ​

void

Overrides ​

LeaferCanvasBase.unrealCanvas

Defined in ​

leafer/packages/canvas/canvas-web/src/LeaferCanvas.ts:205


destroy ​

▸ destroy(): void

Returns ​

void

Overrides ​

LeaferCanvasBase.destroy

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 ​

NameType
_anumber | IMatrixData
_b?number
_c?number
_d?number
_e?number
_f?number

Returns ​

void

Inherited from ​

LeaferCanvasBase.setTransform

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 ​

IMatrixData

Inherited from ​

LeaferCanvasBase.getTransform

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:147


save ​

▸ save(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.save

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:150


restore ​

▸ restore(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.restore

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:153


transform ​

▸ transform(a, b?, c?, d?, e?, f?): void

Parameters ​

NameType
anumber | IMatrixData
b?number
c?number
d?number
e?number
f?number

Returns ​

void

Inherited from ​

LeaferCanvasBase.transform

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:155


translate ​

▸ translate(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.translate

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:164


scale ​

▸ scale(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.scale

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:167


rotate ​

▸ rotate(_angle): void

Parameters ​

NameType
_anglenumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.rotate

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:170


fill ​

▸ fill(_path2d?, _rule?): void

Parameters ​

NameType
_path2d?IWindingRule | IPath2D
_rule?IWindingRule

Returns ​

void

Inherited from ​

LeaferCanvasBase.fill

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:173


stroke ​

▸ stroke(_path2d?): void

Parameters ​

NameType
_path2d?IPath2D

Returns ​

void

Inherited from ​

LeaferCanvasBase.stroke

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:176


clip ​

▸ clip(_path2d?, _rule?): void

Parameters ​

NameType
_path2d?IWindingRule | IPath2D
_rule?IWindingRule

Returns ​

void

Inherited from ​

LeaferCanvasBase.clip

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:179


fillRect ​

▸ fillRect(_x, _y, _width, _height): void

Parameters ​

NameType
_xnumber
_ynumber
_widthnumber
_heightnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.fillRect

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:182


strokeRect ​

▸ strokeRect(_x, _y, _width, _height): void

Parameters ​

NameType
_xnumber
_ynumber
_widthnumber
_heightnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.strokeRect

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:185


clearRect ​

▸ clearRect(_x, _y, _width, _height): void

Parameters ​

NameType
_xnumber
_ynumber
_widthnumber
_heightnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.clearRect

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:188


drawImage ​

▸ drawImage(image, sx, sy, sw?, sh?, dx?, dy?, dw?, dh?): void

Parameters ​

NameType
imageCanvasImageSource
sxnumber
synumber
sw?number
sh?number
dx?number
dy?number
dw?number
dh?number

Returns ​

void

Inherited from ​

LeaferCanvasBase.drawImage

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:190


beginPath ​

▸ beginPath(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.beginPath

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:224


moveTo ​

▸ moveTo(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.moveTo

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:227


lineTo ​

▸ lineTo(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.lineTo

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:230


bezierCurveTo ​

▸ bezierCurveTo(_cp1x, _cp1y, _cp2x, _cp2y, _x, _y): void

Parameters ​

NameType
_cp1xnumber
_cp1ynumber
_cp2xnumber
_cp2ynumber
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.bezierCurveTo

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:233


quadraticCurveTo ​

▸ quadraticCurveTo(_cpx, _cpy, _x, _y): void

Parameters ​

NameType
_cpxnumber
_cpynumber
_xnumber
_ynumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.quadraticCurveTo

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:236


closePath ​

▸ closePath(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.closePath

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:239


arc ​

▸ arc(_x, _y, _radius, _startAngle, _endAngle, _anticlockwise?): void

Parameters ​

NameType
_xnumber
_ynumber
_radiusnumber
_startAnglenumber
_endAnglenumber
_anticlockwise?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.arc

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:242


arcTo ​

▸ arcTo(_x1, _y1, _x2, _y2, _radius): void

Parameters ​

NameType
_x1number
_y1number
_x2number
_y2number
_radiusnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.arcTo

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:245


ellipse ​

▸ ellipse(_x, _y, _radiusX, _radiusY, _rotation, _startAngle, _endAngle, _anticlockwise?): void

Parameters ​

NameType
_xnumber
_ynumber
_radiusXnumber
_radiusYnumber
_rotationnumber
_startAnglenumber
_endAnglenumber
_anticlockwise?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.ellipse

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:248


rect ​

▸ rect(_x, _y, _width, _height): void

Parameters ​

NameType
_xnumber
_ynumber
_widthnumber
_heightnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.rect

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:251


roundRect ​

▸ roundRect(_x, _y, _width, _height, _radius?): void

Parameters ​

NameType
_xnumber
_ynumber
_widthnumber
_heightnumber
_radius?number | number[]

Returns ​

void

Inherited from ​

LeaferCanvasBase.roundRect

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:254


createConicGradient ​

▸ createConicGradient(_startAngle, _x, _y): CanvasGradient

Parameters ​

NameType
_startAnglenumber
_xnumber
_ynumber

Returns ​

CanvasGradient

Inherited from ​

LeaferCanvasBase.createConicGradient

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:261


createLinearGradient ​

▸ createLinearGradient(_x0, _y0, _x1, _y1): CanvasGradient

Parameters ​

NameType
_x0number
_y0number
_x1number
_y1number

Returns ​

CanvasGradient

Inherited from ​

LeaferCanvasBase.createLinearGradient

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:264


createPattern ​

▸ createPattern(_image, _repetition): CanvasPattern

Parameters ​

NameType
_imageCanvasImageSource
_repetitionstring

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 ​

NameType
_x0number
_y0number
_r0number
_x1number
_y1number
_r1number

Returns ​

CanvasGradient

Inherited from ​

LeaferCanvasBase.createRadialGradient

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:270


fillText ​

▸ fillText(_text, _x, _y, _maxWidth?): void

Parameters ​

NameType
_textstring
_xnumber
_ynumber
_maxWidth?number

Returns ​

void

Inherited from ​

LeaferCanvasBase.fillText

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:274


measureText ​

▸ measureText(_text): ITextMetrics

Parameters ​

NameType
_textstring

Returns ​

ITextMetrics

Inherited from ​

LeaferCanvasBase.measureText

Defined in ​

leafer/packages/canvas/canvas/src/Canvas.ts:277


strokeText ​

▸ strokeText(_text, _x, _y, _maxWidth?): void

Parameters ​

NameType
_textstring
_xnumber
_ynumber
_maxWidth?number

Returns ​

void

Inherited from ​

LeaferCanvasBase.strokeText

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 ​

NameType
_filenamestring
_options?number | boolean | IExportOptions

Returns ​

string | Promise<any>

Inherited from ​

LeaferCanvasBase.export

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:79


toBlob ​

▸ toBlob(_type?, _quality?): Promise<any>

Parameters ​

NameType
_type?IExportFileType
_quality?number

Returns ​

Promise<any>

Inherited from ​

LeaferCanvasBase.toBlob

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:81


toDataURL ​

▸ toDataURL(_type?, _quality?): string | Promise<string>

Parameters ​

NameType
_type?IExportImageType
_quality?number

Returns ​

string | Promise<string>

Inherited from ​

LeaferCanvasBase.toDataURL

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:83


saveAs ​

▸ saveAs(_filename, _quality?): Promise<boolean>

Parameters ​

NameType
_filenamestring
_quality?number

Returns ​

Promise<boolean>

Inherited from ​

LeaferCanvasBase.saveAs

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:85


resize ​

▸ resize(size, safeResize?): void

Parameters ​

NameTypeDefault value
sizeIScreenSizeDataundefined
safeResizebooleantrue

Returns ​

void

Inherited from ​

LeaferCanvasBase.resize

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:89


getClientBounds ​

▸ getClientBounds(update?): IBoundsData

Parameters ​

NameType
update?boolean

Returns ​

IBoundsData

Inherited from ​

LeaferCanvasBase.getClientBounds

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:120


setCursor ​

▸ setCursor(_cursor): void

Parameters ​

NameType
_cursorICursorType | ICursorType[]

Returns ​

void

Inherited from ​

LeaferCanvasBase.setCursor

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:128


setWorld ​

▸ setWorld(matrix, parentMatrix?): void

Parameters ​

NameType
matrixIMatrixData
parentMatrix?IMatrixData

Returns ​

void

Inherited from ​

LeaferCanvasBase.setWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:130


useWorldTransform ​

▸ useWorldTransform(worldTransform?): void

Parameters ​

NameType
worldTransform?IMatrixData

Returns ​

void

Inherited from ​

LeaferCanvasBase.useWorldTransform

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:158


setStroke ​

▸ setStroke(color, strokeWidth, options?): void

Parameters ​

NameType
colorstring | object
strokeWidthnumber
options?ICanvasStrokeOptions

Returns ​

void

Inherited from ​

LeaferCanvasBase.setStroke

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:164


setStrokeOptions ​

▸ setStrokeOptions(options): void

Parameters ​

NameType
optionsICanvasStrokeOptions

Returns ​

void

Inherited from ​

LeaferCanvasBase.setStrokeOptions

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:170


saveBlendMode ​

▸ saveBlendMode(blendMode): void

Parameters ​

NameType
blendModeIBlendMode

Returns ​

void

Inherited from ​

LeaferCanvasBase.saveBlendMode

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:178


restoreBlendMode ​

▸ restoreBlendMode(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.restoreBlendMode

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:183


hitFill ​

▸ hitFill(_point, _fillRule?): boolean

Parameters ​

NameType
_pointIPointData
_fillRule?IWindingRule

Returns ​

boolean

Inherited from ​

LeaferCanvasBase.hitFill

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:189


hitStroke ​

▸ hitStroke(_point, _strokeWidth?): boolean

Parameters ​

NameType
_pointIPointData
_strokeWidth?number

Returns ​

boolean

Inherited from ​

LeaferCanvasBase.hitStroke

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:191


hitPixel ​

▸ hitPixel(_radiusPoint, _offset?, _scale?): boolean

Parameters ​

NameTypeDefault value
_radiusPointIRadiusPointDataundefined
_offset?IPointDataundefined
_scalenumber1

Returns ​

boolean

Inherited from ​

LeaferCanvasBase.hitPixel

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:193


setWorldShadow ​

▸ setWorldShadow(x, y, blur, color?): void

Parameters ​

NameType
xnumber
ynumber
blurnumber
color?string

Returns ​

void

Inherited from ​

LeaferCanvasBase.setWorldShadow

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:197


setWorldBlur ​

▸ setWorldBlur(blur): void

Parameters ​

NameType
blurnumber

Returns ​

void

Inherited from ​

LeaferCanvasBase.setWorldBlur

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:205


copyWorld ​

▸ copyWorld(canvas, from?, to?, blendMode?): void

Parameters ​

NameType
canvasILeaferCanvas
from?IBoundsData
to?IBoundsData
blendMode?IBlendMode

Returns ​

void

Inherited from ​

LeaferCanvasBase.copyWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:211


copyWorldToInner ​

▸ copyWorldToInner(canvas, fromWorld, toInnerBounds, blendMode?): void

Parameters ​

NameType
canvasILeaferCanvas
fromWorldIMatrixWithBoundsData
toInnerBoundsIBoundsData
blendMode?IBlendMode

Returns ​

void

Inherited from ​

LeaferCanvasBase.copyWorldToInner

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:223


copyWorldByReset ​

▸ copyWorldByReset(canvas, from?, to?, blendMode?, onlyResetTransform?): void

Parameters ​

NameType
canvasILeaferCanvas
from?IBoundsData
to?IBoundsData
blendMode?IBlendMode
onlyResetTransform?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.copyWorldByReset

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:237


useGrayscaleAlpha ​

▸ useGrayscaleAlpha(bounds): void

Parameters ​

NameType
boundsIBoundsData

Returns ​

void

Inherited from ​

LeaferCanvasBase.useGrayscaleAlpha

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:243


useMask ​

▸ useMask(maskCanvas, fromBounds?, toBounds?): void

Parameters ​

NameType
maskCanvasILeaferCanvas
fromBounds?IBoundsData
toBounds?IBoundsData

Returns ​

void

Inherited from ​

LeaferCanvasBase.useMask

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:257


useEraser ​

▸ useEraser(eraserCanvas, fromBounds?, toBounds?): void

Parameters ​

NameType
eraserCanvasILeaferCanvas
fromBounds?IBoundsData
toBounds?IBoundsData

Returns ​

void

Inherited from ​

LeaferCanvasBase.useEraser

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:261


fillWorld ​

▸ fillWorld(bounds, color, blendMode?): void

Parameters ​

NameType
boundsIBoundsData
colorstring | object
blendMode?IBlendMode

Returns ​

void

Inherited from ​

LeaferCanvasBase.fillWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:265


strokeWorld ​

▸ strokeWorld(bounds, color, blendMode?): void

Parameters ​

NameType
boundsIBoundsData
colorstring | object
blendMode?IBlendMode

Returns ​

void

Inherited from ​

LeaferCanvasBase.strokeWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:273


clearWorld ​

▸ clearWorld(bounds, ceilPixel?): void

Parameters ​

NameType
boundsIBoundsData
ceilPixel?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.clearWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:281


clipWorld ​

▸ clipWorld(bounds, ceilPixel?): void

Parameters ​

NameType
boundsIBoundsData
ceilPixel?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.clipWorld

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:286


clear ​

▸ clear(): void

Returns ​

void

Inherited from ​

LeaferCanvasBase.clear

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:294


setTempBounds ​

▸ setTempBounds(bounds, ceil?, intersect?): void

Parameters ​

NameType
boundsIBoundsData
ceil?boolean
intersect?boolean

Returns ​

void

Inherited from ​

LeaferCanvasBase.setTempBounds

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:302


isSameSize ​

▸ isSameSize(size): boolean

Parameters ​

NameType
sizeIScreenSizeData

Returns ​

boolean

Inherited from ​

LeaferCanvasBase.isSameSize

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:309


getSameCanvas ​

▸ getSameCanvas(useSameWorldTransform?, useSameSmooth?): ILeaferCanvas

Parameters ​

NameType
useSameWorldTransform?boolean
useSameSmooth?boolean

Returns ​

ILeaferCanvas

Inherited from ​

LeaferCanvasBase.getSameCanvas

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:314


recycle ​

▸ recycle(clearBounds?): void

Parameters ​

NameType
clearBounds?IBoundsData

Returns ​

void

Inherited from ​

LeaferCanvasBase.recycle

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:325


updateRender ​

▸ updateRender(_bounds?): void

Parameters ​

NameType
_bounds?IBoundsData

Returns ​

void

Inherited from ​

LeaferCanvasBase.updateRender

Defined in ​

leafer/packages/canvas/canvas/src/LeaferCanvasBase.ts:333

Released under the MIT License.