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

Hierarchy

  • ImageViewerPluginBase
    • PaintToolsPlugin

Accessors

  • get in17n(): i18n
  • Gets the internationalization (i18n) instance from the viewer.

    Returns

    The i18n instance.

    Returns i18n

  • get isReady(): boolean
  • Returns true if the image is loaded into the viewer and the image format is supported by the plugin.

    Returns boolean

  • get naturalSize(): { width: number; height: number }
  • Natural image size.

    Returns { width: number; height: number }

    • width: number
    • height: number
  • get paintLayer(): IImageLayer
  • Gets the paint layer containing the HTML canvas for drawing the image.

    Returns IImageLayer

  • get viewer(): IImageViewer
  • Gets the image viewer instance.

    Returns

    The image viewer instance.

    Returns IImageViewer

  • 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

    An array of toolbar item types.

    Returns ToolbarItemType[]

  • 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

    An array of toolbar item types.

    Returns ToolbarItemType[]

  • 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

    An array of toolbar item types.

    Returns ToolbarItemType[]

  • 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

    An array of toolbar item types.

    Returns ToolbarItemType[]

Methods

  • Determines whether the specified image format is supported for modifications.

    Returns

    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)

    Example

    // Check if PNG is supported
    const supported = isImageFormatSupported(ImageFormatCode.PNG);

    Example

    // Check if an unknown format is supported (returns false by default)
    const supported = isImageFormatSupported('custom-format');

    Example

    // Check if an unknown format is supported (returns true when allowUnknown is true)
    const supported = isImageFormatSupported('custom-format', true);

    Parameters

    • imageFormat: string | ImageFormatCode

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

    • Optional allowUnknown: boolean

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

    Returns boolean

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

    Returns

    Returns void

Properties

id: string = "paintTools"

Unique plugin identifier.

Plugin options

Constructors