Skip to content

Class: LeaferCanvasBase ​

Hierarchy ​

Implements ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

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

Parameters ​

NameType
config?ILeaferCanvasConfig
manager?ICanvasManager

Returns ​

LeaferCanvasBase

Overrides ​

Canvas.constructor

Defined in ​

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

Properties ​

context ​

• context: ICanvasContext2D

Implementation of ​

ILeaferCanvas.context

Inherited from ​

Canvas.context

Defined in ​

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


smooth ​

• smooth: boolean

Implementation of ​

ILeaferCanvas.smooth

Inherited from ​

Canvas.smooth

Defined in ​

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


smoothLevel ​

• smoothLevel: ImageSmoothingQuality

Implementation of ​

ILeaferCanvas.smoothLevel

Inherited from ​

Canvas.smoothLevel

Defined in ​

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


opacity ​

• opacity: number

Implementation of ​

ILeaferCanvas.opacity

Inherited from ​

Canvas.opacity

Defined in ​

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


fillStyle ​

• fillStyle: string | object

Implementation of ​

ILeaferCanvas.fillStyle

Inherited from ​

Canvas.fillStyle

Defined in ​

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


strokeStyle ​

• strokeStyle: string | object

Implementation of ​

ILeaferCanvas.strokeStyle

Inherited from ​

Canvas.strokeStyle

Defined in ​

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


strokeWidth ​

• strokeWidth: number

Implementation of ​

ILeaferCanvas.strokeWidth

Inherited from ​

Canvas.strokeWidth

Defined in ​

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


strokeCap ​

• strokeCap: string

Implementation of ​

ILeaferCanvas.strokeCap

Inherited from ​

Canvas.strokeCap

Defined in ​

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


strokeJoin ​

• strokeJoin: string

Implementation of ​

ILeaferCanvas.strokeJoin

Inherited from ​

Canvas.strokeJoin

Defined in ​

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


dashOffset ​

• dashOffset: number

Implementation of ​

ILeaferCanvas.dashOffset

Inherited from ​

Canvas.dashOffset

Defined in ​

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


miterLimit ​

• miterLimit: number

Implementation of ​

ILeaferCanvas.miterLimit

Inherited from ​

Canvas.miterLimit

Defined in ​

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


shadowBlur ​

• shadowBlur: number

Implementation of ​

ILeaferCanvas.shadowBlur

Inherited from ​

Canvas.shadowBlur

Defined in ​

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


shadowColor ​

• shadowColor: string

Implementation of ​

ILeaferCanvas.shadowColor

Inherited from ​

Canvas.shadowColor

Defined in ​

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


shadowOffsetX ​

• shadowOffsetX: number

Implementation of ​

ILeaferCanvas.shadowOffsetX

Inherited from ​

Canvas.shadowOffsetX

Defined in ​

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


shadowOffsetY ​

• shadowOffsetY: number

Implementation of ​

ILeaferCanvas.shadowOffsetY

Inherited from ​

Canvas.shadowOffsetY

Defined in ​

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


filter ​

• filter: string

Implementation of ​

ILeaferCanvas.filter

Inherited from ​

Canvas.filter

Defined in ​

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


font ​

• font: string

Implementation of ​

ILeaferCanvas.font

Inherited from ​

Canvas.font

Defined in ​

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


fontKerning ​

• fontKerning: string

Implementation of ​

ILeaferCanvas.fontKerning

Inherited from ​

Canvas.fontKerning

Defined in ​

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


fontStretch ​

• fontStretch: string

Implementation of ​

ILeaferCanvas.fontStretch

Inherited from ​

Canvas.fontStretch

Defined in ​

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


fontVariantCaps ​

• fontVariantCaps: string

Implementation of ​

ILeaferCanvas.fontVariantCaps

Inherited from ​

Canvas.fontVariantCaps

Defined in ​

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


textAlign ​

• textAlign: string

Implementation of ​

ILeaferCanvas.textAlign

Inherited from ​

Canvas.textAlign

Defined in ​

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


textBaseline ​

• textBaseline: string

Implementation of ​

ILeaferCanvas.textBaseline

Inherited from ​

Canvas.textBaseline

Defined in ​

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


textRendering ​

• textRendering: string

Implementation of ​

ILeaferCanvas.textRendering

Inherited from ​

Canvas.textRendering

Defined in ​

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


wordSpacing ​

• wordSpacing: string

Implementation of ​

ILeaferCanvas.wordSpacing

Inherited from ​

Canvas.wordSpacing

Defined in ​

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


letterSpacing ​

• letterSpacing: string

Implementation of ​

ILeaferCanvas.letterSpacing

Inherited from ​

Canvas.letterSpacing

Defined in ​

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


direction ​

• direction: string

Implementation of ​

ILeaferCanvas.direction

Inherited from ​

Canvas.direction

Defined in ​

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


innerId ​

• Readonly innerId: number

Implementation of ​

ILeaferCanvas.innerId

Overrides ​

Canvas.innerId

Defined in ​

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


name ​

• name: string

Implementation of ​

ILeaferCanvas.name

Defined in ​

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


manager ​

• manager: ICanvasManager

Implementation of ​

ILeaferCanvas.manager

Defined in ​

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


size ​

• size: IScreenSizeData

Defined in ​

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


bounds ​

• bounds: IBounds

Implementation of ​

ILeaferCanvas.bounds

Defined in ​

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


clientBounds ​

• clientBounds: IBoundsData

Implementation of ​

ILeaferCanvas.clientBounds

Defined in ​

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


config ​

• config: ILeaferCanvasConfig

Implementation of ​

ILeaferCanvas.config

Defined in ​

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


autoLayout ​

• autoLayout: boolean

Implementation of ​

ILeaferCanvas.autoLayout

Defined in ​

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


view ​

• view: any

Implementation of ​

ILeaferCanvas.view

Defined in ​

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


parentView ​

• parentView: any

Implementation of ​

ILeaferCanvas.parentView

Defined in ​

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


unreal ​

• Optional unreal: boolean

Implementation of ​

ILeaferCanvas.unreal

Defined in ​

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


recycled ​

• Optional recycled: boolean

Implementation of ​

ILeaferCanvas.recycled

Defined in ​

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


worldTransform ​

• worldTransform: IMatrixData

Implementation of ​

ILeaferCanvas.worldTransform

Defined in ​

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


savedBlendMode ​

• Protected savedBlendMode: IBlendMode

Defined in ​

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

Accessors ​

blendMode ​

• get blendMode(): IBlendMode

Returns ​

IBlendMode

Implementation of ​

ILeaferCanvas.blendMode

Inherited from ​

Canvas.blendMode

Defined in ​

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

• set blendMode(value): void

Parameters ​

NameType
valueIBlendMode

Returns ​

void

Implementation of ​

ILeaferCanvas.blendMode

Inherited from ​

Canvas.blendMode

Defined in ​

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


dashPattern ​

• get dashPattern(): number[]

Returns ​

number[]

Implementation of ​

ILeaferCanvas.dashPattern

Inherited from ​

Canvas.dashPattern

Defined in ​

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

• set dashPattern(value): void

Parameters ​

NameType
valuenumber[]

Returns ​

void

Implementation of ​

ILeaferCanvas.dashPattern

Inherited from ​

Canvas.dashPattern

Defined in ​

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


width ​

• get width(): number

Returns ​

number

Implementation of ​

ILeaferCanvas.width

Defined in ​

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


height ​

• get height(): number

Returns ​

number

Implementation of ​

ILeaferCanvas.height

Defined in ​

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


pixelRatio ​

• get pixelRatio(): number

Returns ​

number

Implementation of ​

ILeaferCanvas.pixelRatio

Defined in ​

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


pixelWidth ​

• get pixelWidth(): number

Returns ​

number

Implementation of ​

ILeaferCanvas.pixelWidth

Defined in ​

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


pixelHeight ​

• get pixelHeight(): number

Returns ​

number

Implementation of ​

ILeaferCanvas.pixelHeight

Defined in ​

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


allowBackgroundColor ​

• get allowBackgroundColor(): boolean

Returns ​

boolean

Implementation of ​

ILeaferCanvas.allowBackgroundColor

Defined in ​

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

Methods ​

__bindContext ​

▸ __bindContext(): void

Returns ​

void

Inherited from ​

Canvas.__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

Implementation of ​

ILeaferCanvas.setTransform

Inherited from ​

Canvas.setTransform

Defined in ​

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


resetTransform ​

▸ resetTransform(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.resetTransform

Inherited from ​

Canvas.resetTransform

Defined in ​

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


getTransform ​

▸ getTransform(): IMatrixData

Returns ​

IMatrixData

Implementation of ​

ILeaferCanvas.getTransform

Inherited from ​

Canvas.getTransform

Defined in ​

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


save ​

▸ save(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.save

Inherited from ​

Canvas.save

Defined in ​

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


restore ​

▸ restore(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.restore

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.transform

Inherited from ​

Canvas.transform

Defined in ​

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


translate ​

▸ translate(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Implementation of ​

ILeaferCanvas.translate

Inherited from ​

Canvas.translate

Defined in ​

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


scale ​

▸ scale(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Implementation of ​

ILeaferCanvas.scale

Inherited from ​

Canvas.scale

Defined in ​

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


rotate ​

▸ rotate(_angle): void

Parameters ​

NameType
_anglenumber

Returns ​

void

Implementation of ​

ILeaferCanvas.rotate

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.fill

Inherited from ​

Canvas.fill

Defined in ​

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


stroke ​

▸ stroke(_path2d?): void

Parameters ​

NameType
_path2d?IPath2D

Returns ​

void

Implementation of ​

ILeaferCanvas.stroke

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.clip

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.fillRect

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.strokeRect

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.clearRect

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.drawImage

Inherited from ​

Canvas.drawImage

Defined in ​

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


beginPath ​

▸ beginPath(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.beginPath

Inherited from ​

Canvas.beginPath

Defined in ​

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


moveTo ​

▸ moveTo(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Implementation of ​

ILeaferCanvas.moveTo

Inherited from ​

Canvas.moveTo

Defined in ​

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


lineTo ​

▸ lineTo(_x, _y): void

Parameters ​

NameType
_xnumber
_ynumber

Returns ​

void

Implementation of ​

ILeaferCanvas.lineTo

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.bezierCurveTo

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.quadraticCurveTo

Inherited from ​

Canvas.quadraticCurveTo

Defined in ​

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


closePath ​

▸ closePath(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.closePath

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.arc

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.arcTo

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.ellipse

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.rect

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.roundRect

Inherited from ​

Canvas.roundRect

Defined in ​

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


createConicGradient ​

▸ createConicGradient(_startAngle, _x, _y): CanvasGradient

Parameters ​

NameType
_startAnglenumber
_xnumber
_ynumber

Returns ​

CanvasGradient

Implementation of ​

ILeaferCanvas.createConicGradient

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.createLinearGradient

Inherited from ​

Canvas.createLinearGradient

Defined in ​

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


createPattern ​

▸ createPattern(_image, _repetition): CanvasPattern

Parameters ​

NameType
_imageCanvasImageSource
_repetitionstring

Returns ​

CanvasPattern

Implementation of ​

ILeaferCanvas.createPattern

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.createRadialGradient

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.fillText

Inherited from ​

Canvas.fillText

Defined in ​

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


measureText ​

▸ measureText(_text): ITextMetrics

Parameters ​

NameType
_textstring

Returns ​

ITextMetrics

Implementation of ​

ILeaferCanvas.measureText

Inherited from ​

Canvas.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

Implementation of ​

ILeaferCanvas.strokeText

Inherited from ​

Canvas.strokeText

Defined in ​

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


init ​

▸ init(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.init

Defined in ​

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


__createContext ​

▸ __createContext(): void

Returns ​

void

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>

Implementation of ​

ILeaferCanvas.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>

Implementation of ​

ILeaferCanvas.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>

Implementation of ​

ILeaferCanvas.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>

Implementation of ​

ILeaferCanvas.saveAs

Defined in ​

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


resize ​

▸ resize(size, safeResize?): void

Parameters ​

NameTypeDefault value
sizeIScreenSizeDataundefined
safeResizebooleantrue

Returns ​

void

Implementation of ​

ILeaferCanvas.resize

Defined in ​

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


updateViewSize ​

▸ updateViewSize(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.updateViewSize

Defined in ​

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


updateClientBounds ​

▸ updateClientBounds(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.updateClientBounds

Defined in ​

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


getClientBounds ​

▸ getClientBounds(update?): IBoundsData

Parameters ​

NameType
update?boolean

Returns ​

IBoundsData

Implementation of ​

ILeaferCanvas.getClientBounds

Defined in ​

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


startAutoLayout ​

▸ startAutoLayout(_autoBounds, _listener): void

Parameters ​

NameType
_autoBoundsIAutoBounds
_listenerIResizeEventListener

Returns ​

void

Implementation of ​

ILeaferCanvas.startAutoLayout

Defined in ​

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


stopAutoLayout ​

▸ stopAutoLayout(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.stopAutoLayout

Defined in ​

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


setCursor ​

▸ setCursor(_cursor): void

Parameters ​

NameType
_cursorICursorType | ICursorType[]

Returns ​

void

Defined in ​

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


setWorld ​

▸ setWorld(matrix, parentMatrix?): void

Parameters ​

NameType
matrixIMatrixData
parentMatrix?IMatrixData

Returns ​

void

Implementation of ​

ILeaferCanvas.setWorld

Defined in ​

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


useWorldTransform ​

▸ useWorldTransform(worldTransform?): void

Parameters ​

NameType
worldTransform?IMatrixData

Returns ​

void

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.setStroke

Defined in ​

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


setStrokeOptions ​

▸ setStrokeOptions(options): void

Parameters ​

NameType
optionsICanvasStrokeOptions

Returns ​

void

Implementation of ​

ILeaferCanvas.setStrokeOptions

Defined in ​

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


saveBlendMode ​

▸ saveBlendMode(blendMode): void

Parameters ​

NameType
blendModeIBlendMode

Returns ​

void

Implementation of ​

ILeaferCanvas.saveBlendMode

Defined in ​

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


restoreBlendMode ​

▸ restoreBlendMode(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.restoreBlendMode

Defined in ​

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


hitFill ​

▸ hitFill(_point, _fillRule?): boolean

Parameters ​

NameType
_pointIPointData
_fillRule?IWindingRule

Returns ​

boolean

Implementation of ​

ILeaferCanvas.hitFill

Defined in ​

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


hitStroke ​

▸ hitStroke(_point, _strokeWidth?): boolean

Parameters ​

NameType
_pointIPointData
_strokeWidth?number

Returns ​

boolean

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.setWorldShadow

Defined in ​

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


setWorldBlur ​

▸ setWorldBlur(blur): void

Parameters ​

NameType
blurnumber

Returns ​

void

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.copyWorldByReset

Defined in ​

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


useGrayscaleAlpha ​

▸ useGrayscaleAlpha(bounds): void

Parameters ​

NameType
boundsIBoundsData

Returns ​

void

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.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

Implementation of ​

ILeaferCanvas.strokeWorld

Defined in ​

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


clearWorld ​

▸ clearWorld(bounds, ceilPixel?): void

Parameters ​

NameType
boundsIBoundsData
ceilPixel?boolean

Returns ​

void

Implementation of ​

ILeaferCanvas.clearWorld

Defined in ​

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


clipWorld ​

▸ clipWorld(bounds, ceilPixel?): void

Parameters ​

NameType
boundsIBoundsData
ceilPixel?boolean

Returns ​

void

Implementation of ​

ILeaferCanvas.clipWorld

Defined in ​

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


clear ​

▸ clear(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.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

Defined in ​

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


isSameSize ​

▸ isSameSize(size): boolean

Parameters ​

NameType
sizeIScreenSizeData

Returns ​

boolean

Implementation of ​

ILeaferCanvas.isSameSize

Defined in ​

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


getSameCanvas ​

▸ getSameCanvas(useSameWorldTransform?, useSameSmooth?): ILeaferCanvas

Parameters ​

NameType
useSameWorldTransform?boolean
useSameSmooth?boolean

Returns ​

ILeaferCanvas

Implementation of ​

ILeaferCanvas.getSameCanvas

Defined in ​

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


recycle ​

▸ recycle(clearBounds?): void

Parameters ​

NameType
clearBounds?IBoundsData

Returns ​

void

Implementation of ​

ILeaferCanvas.recycle

Defined in ​

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


updateRender ​

▸ updateRender(_bounds?): void

Parameters ​

NameType
_bounds?IBoundsData

Returns ​

void

Implementation of ​

ILeaferCanvas.updateRender

Defined in ​

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


unrealCanvas ​

▸ unrealCanvas(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.unrealCanvas

Defined in ​

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


destroy ​

▸ destroy(): void

Returns ​

void

Implementation of ​

ILeaferCanvas.destroy

Overrides ​

Canvas.destroy

Defined in ​

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

Released under the MIT License.