Difference between revisions of "Extension subsystem"

From Inkscape Wiki
Jump to navigation Jump to search
Line 10: Line 10:
There are several types of functionality provided by the extensions
There are several types of functionality provided by the extensions
system today, and more are slated for the future.
system today, and more are slated for the future.
-- Input.  Input extensions take data from a file and bring it into
* Input.  Input extensions take data from a file and bring it into
Inkscape.  Even reading SVG files (Inkscape's native format) is
Inkscape.  Even reading SVG files (Inkscape's native format) is
implemented as an internal extension.  Input extensions can be chained
implemented as an internal extension.  Input extensions can be chained
so that extensions can be created that don't make it all the way to SVG
so that extensions can be created that don't make it all the way to SVG
directly.
directly.
-- Output.  Output extensions take the data from Inkscape and turn it
* Output.  Output extensions take the data from Inkscape and turn it
into a file.  SVG Output is an internal extension.  Output extensions
into a file.  SVG Output is an internal extension.  Output extensions
can also be chained.
can also be chained.
-- Effects.  Effects are extension that take a document, and possibly a
* Effects.  Effects are extension that take a document, and possibly a
selection, and change it in some way.  This could be anything from
selection, and change it in some way.  This could be anything from
changing colors to generating fractals.  These are similar to Filters in
changing colors to generating fractals.  These are similar to Filters in
The GIMP.
The GIMP.
-- Path Effects.  Path effects provide a way to change a path.  They
* Path Effects.  Path effects provide a way to change a path.  They
allow a user to edit a path using the standard Inkscape path editing
allow a user to edit a path using the standard Inkscape path editing
tools, but then have it look differently than just a line.  This could
tools, but then have it look differently than just a line.  This could
include everything from adding hash marks to making the line look like
include everything from adding hash marks to making the line look like
it's on fire.
it's on fire.
-- Tools.  Tools are the ways that you draw in Inkscape.  Rectangle
* Tools.  Tools are the ways that you draw in Inkscape.  Rectangle
tool, circle tool, star tool...  the goal is to eventually have the
tool, circle tool, star tool...  the goal is to eventually have the
ability to add tools as extensions.
ability to add tools as extensions.
Line 36: Line 36:
allows for programmers to implement their extension in  a variety of
allows for programmers to implement their extension in  a variety of
ways, trying to match their particular skillset.
ways, trying to match their particular skillset.
-- Internal.  Any extension type can be implement in C or C++ and
* Internal.  Any extension type can be implement in C or C++ and
directly linked into the Inkscape codebase.  While in general the goal
directly linked into the Inkscape codebase.  While in general the goal
is to move as much out of the main Inkscape binary, this makes sense for
is to move as much out of the main Inkscape binary, this makes sense for
many extensions including things like SVG input/output.
many extensions including things like SVG input/output.
-- Scripts.  Scripts are where Inkscape uses standard in and standard
* Scripts.  Scripts are where Inkscape uses standard in and standard
out on an external executable to implement the functionality.  This
out on an external executable to implement the functionality.  This
allow Inkscape to reuse a variety of utilities that already do format
allow Inkscape to reuse a variety of utilities that already do format
Line 46: Line 46:
are effects use a SVG DOM library in their programming language of
are effects use a SVG DOM library in their programming language of
choice.
choice.
-- XSLT.  This implementation is done in the XSLT language, and uses
* XSLT.  This implementation is done in the XSLT language, and uses
libxml's XSLT parser that is already linked with Inkscape.
libxml's XSLT parser that is already linked with Inkscape.
-- DOM Scripts.  As Inkscape finishes its DOM implementation the goal
* DOM Scripts.  As Inkscape finishes its DOM implementation the goal
will be to provide this directly to scripts.  This will allow for faster
will be to provide this directly to scripts.  This will allow for faster
execution, but also other access to Inkscape's internals and algorithms.
execution, but also other access to Inkscape's internals and algorithms.

Revision as of 13:23, 16 November 2006

General

The Extension system is a way to add functionality to Inkscape. The design of the extension system follows the bridge design pattern, breaking apart the functionality that is being provided, and the implementation of that functionality. The term extension is used to describe all of this, the functionality and the implementation.

Functionality Provided

There are several types of functionality provided by the extensions system today, and more are slated for the future.

  • Input. Input extensions take data from a file and bring it into

Inkscape. Even reading SVG files (Inkscape's native format) is implemented as an internal extension. Input extensions can be chained so that extensions can be created that don't make it all the way to SVG directly.

  • Output. Output extensions take the data from Inkscape and turn it

into a file. SVG Output is an internal extension. Output extensions can also be chained.

  • Effects. Effects are extension that take a document, and possibly a

selection, and change it in some way. This could be anything from changing colors to generating fractals. These are similar to Filters in The GIMP.

  • Path Effects. Path effects provide a way to change a path. They

allow a user to edit a path using the standard Inkscape path editing tools, but then have it look differently than just a line. This could include everything from adding hash marks to making the line look like it's on fire.

  • Tools. Tools are the ways that you draw in Inkscape. Rectangle

tool, circle tool, star tool... the goal is to eventually have the ability to add tools as extensions.

Implementation Types

While the functionality that the extension provides is described above, how that gets done is a different story. The Inkscape extensions system allows for programmers to implement their extension in a variety of ways, trying to match their particular skillset.

  • Internal. Any extension type can be implement in C or C++ and

directly linked into the Inkscape codebase. While in general the goal is to move as much out of the main Inkscape binary, this makes sense for many extensions including things like SVG input/output.

  • Scripts. Scripts are where Inkscape uses standard in and standard

out on an external executable to implement the functionality. This allow Inkscape to reuse a variety of utilities that already do format conversion or implement cool things in SVG. Typically the scripts that are effects use a SVG DOM library in their programming language of choice.

  • XSLT. This implementation is done in the XSLT language, and uses

libxml's XSLT parser that is already linked with Inkscape.

  • DOM Scripts. As Inkscape finishes its DOM implementation the goal

will be to provide this directly to scripts. This will allow for faster execution, but also other access to Inkscape's internals and algorithms.

See Also

http://sourceforge.net/mailarchive/message.php?msg_id=15742559