[]
        
(Showing Draft Content)

ImageLayer

Interface: ImageLayer

Image layer canvas.

Properties

name

name: string;

Image layer name.


size

readonly size: Size;

Image layer size.


mainCanvas

readonly mainCanvas: HTMLCanvasElement;

Canvas object to paint.


backCanvas

readonly backCanvas: HTMLCanvasElement;

Canvas object to paint.


mainCtx

readonly mainCtx: CanvasRenderingContext2D;

Main 2D rendering context.


backCtx

readonly backCtx: CanvasRenderingContext2D;

Background 2D rendering context.


paintObjects

readonly paintObjects: PaintObject<PaintObjectType>[];

The objects in this array are drawn to the canvas.

Methods

clear()

clear(clearCache): void;

Removes everything drawn before on image layer.

Parameters

clearCache

boolean

Indicates if should clear cache too.

Returns

void


dispose()

dispose(): void;

Clears all resources and removes image layer.

Returns

void


ensureBackground()

ensureBackground(): Promise<void>;

Draws an original viewer image on image layer.

Returns

Promise<void>


merge()

merge(): Promise<void>;

Merges image layer into original viewer image.

Returns

Promise<void>


saveToDataURL()

saveToDataURL(): Promise<string>;

Clears all resources and removes image layer.

Returns

Promise<string>

Promise with string that contains dataUrl


drawObjects()

drawObjects(): Promise<void>;

Call this method to draw the paint objects specified in the paintObjects array onto the canvas.

Returns

Promise<void>


executeTempPaintCommand()

executeTempPaintCommand(cmd): void;

Run a temporary paint command on a separate temporary canvas layer. This method should create and display the temporary canvas layer if it doesn't exist.

Parameters

cmd

PaintCommand

Returns

void


getTempPaintCommands()

getTempPaintCommands(): PaintCommand[];

Get all temporary paint commands.

Returns

PaintCommand[]


clearTempPaintCommands()

clearTempPaintCommands(): void;

Clear all temporary paint commands, clear and dispose the temporary canvas layer.

Returns

void