跳转到内容

Pattern

See

Constructors

new Pattern()

new Pattern(options?): Pattern

Constructor

Parameters

options?: PatternOptions

Options object

Returns

Pattern

Defined in

src/Pattern/Pattern.ts:95

Properties

crossOrigin

crossOrigin: TCrossOrigin = ''

Default

Defined in

src/Pattern/Pattern.ts:63


excludeFromExport?

optional excludeFromExport: boolean

If true, this object will not be exported during the serialization of a canvas

Defined in

src/Pattern/Pattern.ts:82


id

readonly id: number

ID used for SVG export functionalities

Defined in

src/Pattern/Pattern.ts:88


offsetX

offsetX: number = 0

Pattern horizontal offset from object’s left/top corner

Default

Defined in

src/Pattern/Pattern.ts:50


offsetY

offsetY: number = 0

Pattern vertical offset from object’s left/top corner

Default

Defined in

src/Pattern/Pattern.ts:57


patternTransform?

optional patternTransform: TMat2D

transform matrix to change the pattern, imported from svgs.

Todo

verify if using the identity matrix as default makes the rest of the code more easy

Default

Defined in

src/Pattern/Pattern.ts:71


repeat

repeat: PatternRepeat = 'repeat'

Defaults

Defined in

src/Pattern/Pattern.ts:43


source

source: CanvasImageSource

The actual pixel source of the pattern

Defined in

src/Pattern/Pattern.ts:76


type

static type: string = 'Pattern'

Defined in

src/Pattern/Pattern.ts:21

Accessors

type

get type(): string

Legacy identifier of the class. Prefer using this.constructor.type ‘Pattern’ or utils like isPattern, or instance of to indentify a pattern in your code. Will be removed in future versiones

TODO

add sustainable warning message

set type(value): void

Parameters

value: string

Returns

string

Defined in

src/Pattern/Pattern.ts:31

Methods

isCanvasSource()

isCanvasSource(): this is Object

Returns

this is Object

true if source is a element

Defined in

src/Pattern/Pattern.ts:112


isImageSource()

isImageSource(): this is Object

Returns

this is Object

true if source is an element

Defined in

src/Pattern/Pattern.ts:103


sourceToString()

sourceToString(): string

Returns

string

Defined in

src/Pattern/Pattern.ts:116


toLive()

toLive(ctx): null | CanvasPattern

Returns an instance of CanvasPattern

Parameters

ctx: CanvasRenderingContext2D

Context to create pattern

Returns

null | CanvasPattern

Defined in

src/Pattern/Pattern.ts:129


toObject()

toObject(propertiesToInclude?): Record<string, any>

Returns object representation of a pattern

Parameters

propertiesToInclude?: string[] = []

Any properties that you might want to additionally include in the output

Returns

Record<string, any>

Object representation of a pattern instance

Defined in

src/Pattern/Pattern.ts:150


toSVG()

toSVG(__namedParameters): string

Returns SVG representation of a pattern

Parameters

__namedParameters: TSize

Returns

string

Defined in

src/Pattern/Pattern.ts:170


fromObject()

static fromObject(__namedParameters, options?): Promise<Pattern>

Parameters

__namedParameters: SerializedPatternOptions

options?: Abortable

Returns

Promise<Pattern>

Defined in

src/Pattern/Pattern.ts:202