Skip to content

Pattern

Defined in: src/Pattern/Pattern.ts:20

new Pattern(options?): Pattern

Defined in: src/Pattern/Pattern.ts:95

Constructor

PatternOptions

Options object

Pattern

crossOrigin: TCrossOrigin = ''

Defined in: src/Pattern/Pattern.ts:63


optional excludeFromExport: boolean

Defined in: src/Pattern/Pattern.ts:82

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


readonly id: number

Defined in: src/Pattern/Pattern.ts:88

ID used for SVG export functionalities


offsetX: number = 0

Defined in: src/Pattern/Pattern.ts:50

Pattern horizontal offset from object’s left/top corner


offsetY: number = 0

Defined in: src/Pattern/Pattern.ts:57

Pattern vertical offset from object’s left/top corner


optional patternTransform: TMat2D

Defined in: src/Pattern/Pattern.ts:71

transform matrix to change the pattern, imported from svgs.

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


repeat: PatternRepeat = 'repeat'

Defined in: src/Pattern/Pattern.ts:43


source: CanvasImageSource

Defined in: src/Pattern/Pattern.ts:76

The actual pixel source of the pattern


static type: string = 'Pattern'

Defined in: src/Pattern/Pattern.ts:21

get type(): string

Defined in: src/Pattern/Pattern.ts:31

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

add sustainable warning message

string

set type(value): void

Defined in: src/Pattern/Pattern.ts:35

string

void

isCanvasSource(): this is { source: HTMLCanvasElement }

Defined in: src/Pattern/Pattern.ts:112

this is { source: HTMLCanvasElement }

true if source is a element


isImageSource(): this is { source: HTMLImageElement }

Defined in: src/Pattern/Pattern.ts:103

this is { source: HTMLImageElement }

true if source is an element


sourceToString(): string

Defined in: src/Pattern/Pattern.ts:116

string


toLive(ctx): null | CanvasPattern

Defined in: src/Pattern/Pattern.ts:129

Returns an instance of CanvasPattern

CanvasRenderingContext2D

Context to create pattern

null | CanvasPattern


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

Defined in: src/Pattern/Pattern.ts:150

Returns object representation of a pattern

string[] = []

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

Record<string, any>

Object representation of a pattern instance


toSVG(__namedParameters): string

Defined in: src/Pattern/Pattern.ts:170

Returns SVG representation of a pattern

TSize

string


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

Defined in: src/Pattern/Pattern.ts:202

SerializedPatternOptions

Abortable

Promise<Pattern>