Difference between revisions of "Extensions"

From Inkscape Wiki
Jump to navigation Jump to search
Line 33: Line 33:
* '''notebook'''
* '''notebook'''


See also [[INX Parameters]]
See also: [[INX Parameters]]


==Extension Definition File (INX)==
==Extension Definition File (INX)==

Revision as of 11:02, 1 November 2010

This page is intended as a guide for providing new extensions for Inkscape. Currently the majority of extensions are provided as python scripts.

Extension types

The following extension types exist for Inkscape:

  • input
  • output
  • effect
  • print
  • path-effect - path effects are not currently implemented as extension but there is intention to migrate those over as entensions

See also: Script extensions

Extension implementation

  • Internal
    • C++ implementation (directly in code)
  • External
    • scripts - written in python, perl or as system (console) scripts
    • xslt transformations
    • plugins - not fully implemented yet

Parameters

Extensions can be supplied with values obtained through easily definable parameters. Inkscape provides the basic GUI for user input. The following parameters are supported:

  • integer
  • string
  • float
  • boolean
  • enum
  • optiongroup
  • colour

For the sake of the UI there are also the following two parameters that do not provide data to the extension but alter the user input GUI.

  • description
  • notebook

See also: INX Parameters

Extension Definition File (INX)

All extensions are defined through Inkscape Extension Definition Files (.inx) which are XML files in the

http://www.inkscape.org/namespace/inkscape/extension

namespace and described by the Relax NG available [here]

Structure

Examples

RadioButton example

The following mark-up:

<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
  <_name>RadioButton example</_name>
  <id>org.inkscape.effect.radiobuttontest</id>
  <param name="radio1" type="optiongroup" _gui-text="Select option: ">
    <option value="string1">translatable string 1</option>
    <option value="string2">string 2</option>
    <option value="string3">test 3!</option>
  </param>
  <param name="radio2" type="optiongroup" _gui-text="Select second option: ">
    <option value="string11">string1</option>
    <option value="string22">string2</option>
    <option>test3!</option>
  </param>
  <effect>
    <object-type>all</object-type>
    <effects-menu>
      <submenu _name="Developer Examples"/>
    </effects-menu>
  </effect>
  ...
</inkscape-extension>

Will result in the following GUI being created:

Extensions-radiobutton gui example.png

i18n

To allow the .inx files to fit snugly into Inkscape's i18n infrastructure some XML elements and attributes are prefixed with an underscore (_) character to indicate that the containing text should be marked for translation.