[]
        
(Showing Draft Content)

PaintToolsPlugin

Class: PaintToolsPlugin

PaintToolsPlugin class. Adds the "Paint tools", "Effects" and "Text and Objects" buttons.

Example

<script src="gcimageviewer.js"></script></head>
<script src="plugins/paintTools.js"></script>
<script>
  var viewer = new GcImageViewer("#root");
  viewer.addPlugin(new PaintToolsPlugin());
</script>

Param

Extends

  • ImageViewerPluginBase

Constructors

Constructor

new PaintToolsPlugin(options?): PaintToolsPlugin;

PaintToolsPlugin constructor.

Parameters

options?

PaintToolsPluginOptions

plugin options

Returns

PaintToolsPlugin

Overrides

ImageViewerPluginBase.constructor

Properties

id

readonly id: string;

Unique plugin identifier.

Overrides

ImageViewerPluginBase.id

options

options: PaintToolsPluginOptions;

Plugin options

Accessors

effectsToolbarLayout

Get Signature

get effectsToolbarLayout(): ToolbarItemType[];

Returns the layout for the effects tools toolbar.

If the value is true, undefined, or null, a default layout is returned. If the value is false, an empty layout is returned. Otherwise, the provided custom layout is used.

Returns

ToolbarItemType[]

An array of toolbar item types.


in17n

Get Signature

get in17n(): i18n;

Gets the internationalization (i18n) instance from the viewer.

Returns

i18n

The i18n instance.

Inherited from

ImageViewerPluginBase.in17n

isReady

Get Signature

get isReady(): boolean;

Returns true if the image is loaded into the viewer and the image format is supported by the plugin.

Returns

boolean

Inherited from

ImageViewerPluginBase.isReady

naturalSize

Get Signature

get naturalSize(): object;

Natural image size.

Returns

object

height
height: number;
width
width: number;

Inherited from

ImageViewerPluginBase.naturalSize

objectsToolbarLayout

Get Signature

get objectsToolbarLayout(): ToolbarItemType[];

Returns the layout for the objects toolbar.

If the value is true, undefined, or null, a default layout is returned. If the value is false, an empty layout is returned. Otherwise, the provided custom layout is used.

Returns

ToolbarItemType[]

An array of toolbar item types.


paintLayer

Get Signature

get paintLayer(): IImageLayer;

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

Returns

IImageLayer

Inherited from

ImageViewerPluginBase.paintLayer

paintToolbarLayout

Get Signature

get paintToolbarLayout(): ToolbarItemType[];

Returns the layout for the paint tools toolbar.

If the value is true, undefined, or null, a default layout is returned. If the value is false, an empty layout is returned. Otherwise, the provided custom layout is used.

Returns

ToolbarItemType[]

An array of toolbar item types.


textToolbarLayout

Get Signature

get textToolbarLayout(): ToolbarItemType[];

Returns the layout for the text tools toolbar.

If the value is true, undefined, or null, a default layout is returned. If the value is false, an empty layout is returned. Otherwise, the provided custom layout is used.

Deprecated

This option is deprecated in favor of the "Text and Objects" toolbar, where text tools are available directly.

See

objectsToolbarLayout

Returns

ToolbarItemType[]

An array of toolbar item types.


viewer

Get Signature

get viewer(): IImageViewer;

Gets the image viewer instance.

Returns

IImageViewer

The image viewer instance.

Inherited from

ImageViewerPluginBase.viewer

Methods

dispose()

dispose(): void;

Cleans up resources and disposes the plugin.

Returns

void

Overrides

ImageViewerPluginBase.dispose

initialize()

initialize(viewer): void;

Initializes the plugin with the given image viewer.

Parameters

viewer

any

The image viewer instance to associate with this plugin.

Returns

void

Overrides

ImageViewerPluginBase.initialize

isImageFormatSupported()

isImageFormatSupported(imageFormat, allowUnknown?): boolean;

Determines whether the specified image format is supported for modifications.

Parameters

imageFormat

The image format to check, either as an enum value or string.

string | ImageFormatCode

allowUnknown?

boolean

If true, allows unknown formats (ImageFormatCode.Default) to be considered supported.

Returns

boolean

True if the format is supported for modifications, false otherwise.

Remarks

The following formats are explicitly not supported:

  • TIFF (ImageFormatCode.TIFF)
  • SVG (ImageFormatCode.SVG)
  • ICO (ImageFormatCode.ICO)
  • GIF (ImageFormatCode.GIF)

Examples

// Check if PNG is supported
const supported = isImageFormatSupported(ImageFormatCode.PNG);
// Check if an unknown format is supported (returns false by default)
const supported = isImageFormatSupported('custom-format');
// Check if an unknown format is supported (returns true when allowUnknown is true)
const supported = isImageFormatSupported('custom-format', true);

Inherited from

ImageViewerPluginBase.isImageFormatSupported

removePaintLayer()

removePaintLayer(): void;

Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.

Returns

void

Inherited from

ImageViewerPluginBase.removePaintLayer