Difference between revisions of "Extensions"

From Inkscape Wiki
Jump to navigation Jump to search
(Move documentation.)
Tags: Replaced Visual edit
 
Line 1: Line 1:
This page is intended as a guide for providing new extensions for Inkscape. Currently the majority of extensions are provided as python scripts.
The documentation for writing new extensions has been moved to the [https://inkscape.gitlab.io/extensions/documentation/authors/index.html documentation of the extensions repository.]
 
==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 <pre>http://www.inkscape.org/namespace/inkscape/extension</pre> namespace and described by the [http://relaxng.org/ Relax NG] available [here]
===Structure===
===Examples===
====RadioButton example====
The following mark-up:
<pre>
<?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>
</pre>
Will result in the following GUI being created:
 
[[Image: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.

Latest revision as of 20:42, 10 March 2022

The documentation for writing new extensions has been moved to the documentation of the extensions repository.