[]
        
(Showing Draft Content)

PaintToolbar

Class: PaintToolbar

Paint tools toolbar panel.

Extends

Implements

Accessors

brushHardness

Get Signature

get brushHardness(): number;

Brush hardness.

Returns

number


brushOpacity

Get Signature

get brushOpacity(): number;

Brush opacity.

Returns

number


brushSize

Get Signature

get brushSize(): number;

Brush size.

Returns

number


cloneStampHardness

Get Signature

get cloneStampHardness(): number;

Clone Stamp hardness.

Returns

number


cloneStampOpacity

Get Signature

get cloneStampOpacity(): number;

Clone Stamp opacity.

Returns

number


cloneStampSize

Get Signature

get cloneStampSize(): number;

Clone Stamp size.

Returns

number


eraserHardness

Get Signature

get eraserHardness(): number;

Eraser hardness.

Returns

number


eraserOpacity

Get Signature

get eraserOpacity(): number;

Eraser opacity.

Returns

number


eraserSize

Get Signature

get eraserSize(): number;

Eraser size.

Returns

number


fontBold

Get Signature

get fontBold(): boolean;

Bold font style.

Returns

boolean


fontItalic

Get Signature

get fontItalic(): boolean;

Italic font style.

Returns

boolean


fontName

Get Signature

get fontName(): string;

Font name.

Returns

string


fontOpacity

Get Signature

get fontOpacity(): number;

Font opacity.

Returns

number


fontSize

Get Signature

get fontSize(): number;

Font size.

Returns

number


foreColor

Get Signature

get foreColor(): Color;

Pencil color.

Returns

Color


maxHeight

Get Signature

get maxHeight(): number;

Max possible crop height.

Returns

number


maxWidth

Get Signature

get maxWidth(): number;

Max possible crop width.

Returns

number


naturalRatio

Get Signature

get naturalRatio(): number;

Natural aspect ratio.

Returns

number


paintLayer

Get Signature

get paintLayer(): IImageLayer;

Gets the paint layer containing the HTML canvas for drawing the image.

Returns

IImageLayer


pencilOpacity

Get Signature

get pencilOpacity(): number;

Pencil opacity.

Returns

number


penSize

Get Signature

get penSize(): number;

Pencil size.

Returns

number


selectedToolKey

Get Signature

get selectedToolKey(): PaintToolType;

Selected tool type.

Returns

PaintToolType


toolHardness

Get Signature

get toolHardness(): number;

Tool hardness.

Returns

number


toolOpacity

Get Signature

get toolOpacity(): number;

Tool opacity.

Returns

number


toolSize

Get Signature

get toolSize(): number;

Tool size.

Returns

number


useOriginalImage

Get Signature

get useOriginalImage(): boolean;

Use the original image as source while applying edits.

Returns

boolean

Set Signature

set useOriginalImage(value): void;

Use the original image as source while applying edits.

Parameters
value

boolean

Returns

void

Methods

showDialog()

static showDialog(paintToolsPlugin): void;

Show toolbar.

Parameters

paintToolsPlugin

PaintToolsPlugin

Returns

void


cancelChanges()

cancelChanges(): Promise<boolean | void>;

Called when parent viewer requests cancel changes, usually when the ESCAPE key is pressed.

Returns

Promise<boolean | void>

Implementation of

IViewerTransactionSupport.cancelChanges


confirmChanges()

confirmChanges(): Promise<void>;

Called when parent viewer requests confirm and apply changes, usually when the Ctrl+Enter or Enter key is pressed.

Returns

Promise<void>

Implementation of

IViewerTransactionSupport.confirmChanges


downloadCommandStack()

downloadCommandStack(args?): Promise<void>;

Serializes and downloads the current command stack as a JSON file. If the browser supports the File System Access API, a native "Save as..." dialog will be used (user can edit the filename). Otherwise the method falls back to creating a Blob and triggering a download via an anchor element (with an optional prompt).

Parameters

args?

Options for export. objectsOnly: true will attempt to export only object-related commands.

objectsOnly

boolean

Returns

Promise<void>

Resolves when the download/save operation is initiated or completed.

Throws

When serialization or file writing fails.


ensurePaintLayerReady()

ensurePaintLayerReady(): Promise<IImageLayer>;

Call this method to create paint layer.

Returns

Promise<IImageLayer>


exportCommands()

exportCommands(commands): string;

Serializes an array of paint commands to a JSON string

Parameters

commands

IPaintCommand[]

Array of paint commands to serialize

Returns

string

JSON string representing the command stack

Throws

When invalid commands are provided


findObjectDesigner()

findObjectDesigner(id): IPaintObjectDesigner;

Finds a paint object designer by its unique identifier.

Parameters

id

string

The unique identifier of the paint object designer.

Returns

IPaintObjectDesigner

The matching designer if found, otherwise undefined.


getHeight()

getHeight(): number;

Crop height.

Returns

number


getPaintObjectDesigners()

getPaintObjectDesigners(): IPaintObjectDesigner[];

Get a reference to an array with object designers.

Returns

IPaintObjectDesigner[]

Implementation of

IPaintDesignerContext.getPaintObjectDesigners


getWidth()

getWidth(): number;

Crop width.

Returns

number


getX()

getX(): number;

Crop x position.

Returns

number


getY()

getY(): number;

Crop y position.

Returns

number


hide()

hide(): void;

Hide toolbar.

Returns

void


importCommands()

importCommands(serializedData): Promise<IPaintCommand[]>;

Deserializes a JSON string to an array of paint commands

Parameters

serializedData

string

JSON string containing serialized commands

Returns

Promise<IPaintCommand[]>

Array of reconstructed paint commands

Throws

When the data cannot be deserialized


importCommandsFromFile()

importCommandsFromFile(): Promise<IPaintCommand[]>;

Opens a file dialog to load commands from a JSON file

Returns

Promise<IPaintCommand[]>

Promise resolving with loaded commands


onPaintObjectPropertyChanged()

onPaintObjectPropertyChanged(
   propertyName, 
   val, 
   dirty?): void;

Called when paint object property changed.

Parameters

propertyName

PaintObjectPropertyName

val

any

dirty?

boolean

Returns

void


redoTransactionStep()

redoTransactionStep(): boolean | void;

Redo viewer transaction step. Return true if redo operation is consumed.

Returns

boolean | void

Implementation of

IViewerTransactionSupport.redoTransactionStep


removeObjectDesigner()

removeObjectDesigner(id): boolean;

Removes an object designer by its ID and disposes of it.

Parameters

id

string

The ID of the object to remove.

Returns

boolean

True if the object was found and removed, false otherwise.


show()

show(): void;

Show toolbar.

Returns

void


toggleTool()

toggleTool(toolKey?, checked?): Promise<void>;

Toggle active paint tool.

Parameters

toolKey?

PaintToolType

Optional. Tool type.

checked?

boolean

Optional. Checked state.

Returns

Promise<void>


undoPaint()

undoPaint(endIndex?): Promise<void>;

Parameters

endIndex?

number

Optional. End undo index (excluding).

Returns

Promise<void>


undoTransactionStep()

undoTransactionStep(): boolean | void;

Undo viewer transaction step. Return true if undo operation is consumed.

Returns

boolean | void

Implementation of

IViewerTransactionSupport.undoTransactionStep