[]
Paint Tools Plugin. Adds the "Paint tools", "Effects" and "Text and Objects" buttons.
<script src="dsimageviewer.js"></script></head>
<script src="plugins/paintTools.js"></script>
<script>
const viewer = new DsImageViewer("#root");
viewer.addPlugin(new PaintToolsPlugin());
</script>
viewer: ImageViewerAPI;
Gets the image viewer instance. The image viewer instance.
PaintToolsPluginAPI.viewer
options: PaintToolsPluginOptions;
Plugin options passed at construction time.
PaintToolsPluginAPI.options
toolsOptions: Required<ToolsOptions>;
Gets or sets the default visual properties for each paint and object tool at runtime.
Reading this property returns the last value set either via the constructor option
toolsOptions or by a previous assignment.
Setting this property immediately:
Previously placed objects and the user's own interactive adjustments are not affected.
// Change arrow and pencil defaults after the viewer has opened
const plugin = viewer.findPlugin('paintTools');
plugin.toolsOptions = {
lineWidth: 3,
lineColor: '#cc0000',
penSize: 5,
penColor: '#333333',
};
PaintToolsPluginAPI.toolsOptions
effectsToolbarLayout: ToolbarItemType[];
Returns the resolved item layout for the Effects toolbar.
Reflects toolbarLayout.effectsTools from plugin options:
true/undefined/null → default layout; false → empty array; array → used as-is.
PaintToolsPluginAPI.effectsToolbarLayout
paintToolbarLayout: 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.
PaintToolsPluginAPI.paintToolbarLayout
textToolbarLayout: 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.
PaintToolsPluginAPI.textToolbarLayout
objectsToolbarLayout: 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.
PaintToolsPluginAPI.objectsToolbarLayout
paintLayer: ImageLayer;
Gets the paint layer containing the HTML canvas for drawing the image.
PaintToolsPluginAPI.paintLayer
isReady: boolean;
Returns true if the image is loaded into the viewer and the image format is supported by the Image Filters plugin.
PaintToolsPluginAPI.isReady
naturalSize: Size;
Natural image size.
PaintToolsPluginAPI.naturalSize
id: PluginType;
Unique plug-in identifier.
PaintToolsPluginAPI.id
isImageFormatSupported(imageFormat, allowUnknown?): boolean;
Determines whether the specified image format is supported for modifications.
The image format to check, either as an enum value or string.
string | ImageFormatCode
boolean
If true, allows unknown formats (ImageFormatCode.Default) to be considered supported.
boolean
True if the format is supported for modifications, false otherwise.
The following formats are explicitly not supported:
// 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);
PaintToolsPluginAPI.isImageFormatSupported
dispose(): void;
Cleans up resources and disposes the plugin.
void
PaintToolsPluginAPI.dispose
removePaintLayer(): void;
Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.
void
PaintToolsPluginAPI.removePaintLayer
initialize(viewer): void;
The method is called when the GcImageViewer component is initialized.
void
PaintToolsPluginAPI.initialize