Skip to content

Pattern

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

new Pattern(options?): Pattern

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

Constructor

PatternOptions

Options object

Pattern

crossOrigin: TCrossOrigin = ''

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


optional excludeFromExport: boolean

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

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


readonly id: number

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

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

Pattern vertical offset from object’s left/top corner


optional patternTransform: TMat2D

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

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


source: CanvasImageSource

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

The actual pixel source of the pattern


static type: string = 'Pattern'

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

get type(): string

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

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

string

void

isCanvasSource(): this is { source: HTMLCanvasElement }

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

this is { source: HTMLCanvasElement }

true if source is a element


isImageSource(): this is { source: HTMLImageElement }

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

this is { source: HTMLImageElement }

true if source is an element


sourceToString(): string

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

string


toLive(ctx): null | CanvasPattern

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

Returns an instance of CanvasPattern

CanvasRenderingContext2D

Context to create pattern

null | CanvasPattern


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

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

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

Returns SVG representation of a pattern

TSize

string


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

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

SerializedPatternOptions

Abortable

Promise<Pattern>