[]
PaintToolsPlugin class. Adds the "Paint tools", "Effects" and "Text and Objects" buttons.
<script src="gcimageviewer.js"></script></head>
<script src="plugins/paintTools.js"></script>
<script>
var viewer = new GcImageViewer("#root");
viewer.addPlugin(new PaintToolsPlugin());
</script>
ImageViewerPluginBase
new PaintToolsPlugin(options?): PaintToolsPlugin;
PaintToolsPlugin constructor.
plugin options
PaintToolsPlugin
ImageViewerPluginBase.constructor
readonly id: string;
Unique plugin identifier.
ImageViewerPluginBase.id
options: PaintToolsPluginOptions;
Plugin options
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.
An array of toolbar item types.
get in17n(): i18n;
Gets the internationalization (i18n) instance from the viewer.
i18n
The i18n instance.
ImageViewerPluginBase.in17n
get isReady(): boolean;
Returns true if the image is loaded into the viewer and the image format is supported by the plugin.
boolean
ImageViewerPluginBase.isReady
get naturalSize(): object;
Natural image size.
object
height: number;
width: number;
ImageViewerPluginBase.naturalSize
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.
An array of toolbar item types.
get paintLayer(): IImageLayer;
Gets the paint layer containing the HTML canvas for drawing the image.
ImageViewerPluginBase.paintLayer
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.
An array of toolbar item types.
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.
This option is deprecated in favor of the "Text and Objects" toolbar, where text tools are available directly.
objectsToolbarLayout
An array of toolbar item types.
get viewer(): IImageViewer;
Gets the image viewer instance.
The image viewer instance.
ImageViewerPluginBase.viewer
dispose(): void;
Cleans up resources and disposes the plugin.
void
ImageViewerPluginBase.dispose
initialize(viewer): void;
Initializes the plugin with the given image viewer.
any
The image viewer instance to associate with this plugin.
void
ImageViewerPluginBase.initialize
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);
ImageViewerPluginBase.isImageFormatSupported
removePaintLayer(): void;
Removes and disposes the active paint layer. If no paint layer exists, this method does nothing.
void
ImageViewerPluginBase.removePaintLayer