Skip to content

Pattern

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

new Pattern(options?): Pattern

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

Constructor

PatternOptions

Options object

Pattern

crossOrigin: TCrossOrigin = ''

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


optional excludeFromExport: boolean

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

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


readonly id: number

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

ID used for SVG export functionalities


offsetX: number = 0

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

Pattern horizontal offset from object’s left/top corner


offsetY: number = 0

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

Pattern vertical offset from object’s left/top corner


optional patternTransform: TMat2D

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

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:72

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:108

this is { source: HTMLCanvasElement }

true if source is a element


isImageSource(): this is { source: HTMLImageElement }

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

this is { source: HTMLImageElement }

true if source is an element


sourceToString(): string

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

string


toLive(ctx): null | CanvasPattern

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

Returns an instance of CanvasPattern

CanvasRenderingContext2D

Context to create pattern

null | CanvasPattern


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

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

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:166

Returns SVG representation of a pattern

TSize

string


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

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

SerializedPatternOptions

Abortable

Promise<Pattern>