Difference between revisions of "Extension architecture proposals"

From Inkscape Wiki
Jump to navigation Jump to search
 
(54 intermediate revisions by 16 users not shown)
Line 1: Line 1:
 
Please place your extension architecture proposals here. Everyone will review them and we will decided a course of action after we release 0.38.
 
Please place your extension architecture proposals here. Everyone will review them and we will decided a course of action after we release 0.38.
  
 +
* [[ExtensionArchProposal]]
  
=== Terminology ===
+
=== Tasks ===
  
* Extension - An extension is something that extends the functionality of Inkscape without being directly part of the core.  This implies that it shoule be easy to remove or add, and nothing in the core should depend on it directly.
+
Design Phase:
* Plug-in - An extension that is implemented through a loadable library.  This is a .o file on Unix-like systems or a .dll on Win32.  The libraries should not be loaded until they are used.
+
* Flesh out each category of functions in the API with ideas for what the functions should be
** PlugIns discussion
+
* Solidify the underlying Extension infrastructure [Ted]
* Script - A script is a type of extension that is implemented through an external program that recieves and sets SVG data through files and pipes.  This allows Inkscape to use programs that handle SVG but are targeted differently seemlessly inside of Inkscape.
+
* Create an example Extension package
** ScriptingLanguages discussion
+
* Write a specification document, including:
* Module - As far as I am aware the only definition of this word in Inkscape is that it was previously used to describe an extension.  The word is deprecated ;)
+
** Overview of Inkscape Extensions
 +
** Creating an Extension
 +
** Registering an Extension
 +
** Custom Extension Preferences
 +
** Extension API Definition
  
=== Inkscape Extension API ===
+
Implementation Phase:
 +
* Implement Extension API
 +
* Implement an Extension registry
 +
* Create Extension preferences dialog
 +
* Create web tool for contributing new Extensions
  
Describe things that one may want to use the API for:
 
  
* Access to currently loaded documents
+
=== Requirements ===
* Ability to load/print/save/close documents
 
  
*** SPDocument * sp_file_open (gchar * uri, Inkscape::Extension::Input * ext)
+
We would like the extension system to provide the following capabilities:
*** bool sp_file_save (SPDocument * doc, gchar * uri, Inkscape::Extension::Output * ext)
 
*** bool sp_print_doc (SPDOcument * doc)
 
  
* Access to the document's SVG object hierarchy
+
* Uses a general language binding system so it's easy to add new language binding support
** Get all SVG id's, retrieve object struct/hash corresponding to id
+
* Allows direct interaction with the document object model including changing styles, adding/removing defs and elements, etc.
** Getting/setting attributes
+
* Allows some limited interaction with the Inkscape UI such as manipulating grids, overlays, etc.
** Getting/setting children
+
* Allows direct interaction with file load/save/export/print subsystem
* Access to all Inkscape verbs
+
* Guaranteed to work properly with the undo system, even if the extension is not written carefully
* Access to preferences
+
* Well documented so is easy for people to learn how to make new extensions
* Access to global def's
+
* Each plugin can be implemented, distributed, and managed independently of the core project
** Gradients
+
* Should be easy to start learning how to create new plugins
** Markers
+
* Icons, buttons, and other UI elements for plugins fit seamlessly into main application GUI
** Patterns
+
* User can easily select which plugins to automatically load into application at startup
* Access to share resources (clipart, templates, etc.)
+
* Loading of plugins shall not seriously slow startup time or make a major impact on memory footprint
* Extension based variables
+
* Failure of a plugin shall not leave the drawing in an inconsistent state
 +
* Main application must gracefully recover from plugin crashes or other serious problems with plugin execution
 +
* Dependencies for particular plugins must be clearly identified for user if missing
  
These are the variables that control settings for the individual extension.  Things that are held internally, but should be saved with the Inkscape preferences.  These are:
+
=== Extension ideas ===
  
*** get_param (gchar * name, [bool, int, gchar *] data)
+
*Plugin to send image to sign making peripherals like the Graphtec or Summa vinyl cutters' and printers'. Adobe Illustrator has such a thing so why not Insckape too?:)
 +
* Cross stitch generator (http://hawthorn.csse.monash.edu.au/~njh/programming/cross-stitch/)
 +
* Celtic knot editor: Using the standard winding number algorithm for Celtic knots build an interactive editor that forms the basic structure of the knots, allowing the user to edit the curve once generated.  (Possible issue - getting the over/under rules correct)  Douglas Zongker's Celtic Knot Thingy is a possible resource: http://isotropic.org/uw/knot/
 +
* mail-merge
 +
* Integrate a capture of a Blender3D frame and then process that bitmap. From a Blender-viewer window?  From a simpler viewer?  Not from a screen capture...higher resolution is desired...
 +
* Socket connection to other apps instead of file-based, where the state of socket connections will be autosaved and restorable after a crash...(since such on the fly work may not be easy to recreate then)
 +
* 3-d rotate - this is a really cool Kai (Kai's Vector Tools/Effects) plug-in for Illustrator
 +
* Inkify - it would be cool to have a plug-in that would take a normal object and make it look like it was drawn with ink.
 +
* Copy Adobe Illustrator's filters (punkify, bloat, calligraphize, etc)
 +
* Copy Dia's plugins
 +
* Look at Karbon14's plugins
 +
* PDF and Postscript import that converts all the type into lines as well as the included postscript vector objects and bitmaps
 +
* Randomize Size and Rotation of Objects
 +
* Create Cluster of objects from one seed with variable quantity, random distribution (noise types, gaussian, etc), variable rotation, opacity, and size
 +
* Zoom effect on shapes. Create an option where a zoom-like effect can be applied to a shape or set of shapes where more shapes are made larger and larger from the central anchor point of the shape(s) passed to this plugin
 +
* Color effects: Invert, Desaturate, etc. http://gimp-savvy.com/BOOK/index.html?node54.html
  
This function gets the variable by the name 'name' with the data in 'data'.  It can be a boolean, integer or a string.
+
[[Category:Developer Discussion]]
  
*** set_param (gchar * name, [bool, int, gchar *] data)
+
=== Existing extensions not bundled with Inkscape ===
  
This function sets the variable by the name 'name' with the data in 'data'. It can be a boolean, integer or a string. In the case of the string it is copied.
+
* [http://www.inkscapeforum.com/viewtopic.php?f=22&t=336 Trace Setup], prepares a document for tracing a bitmap image
 
+
* [http://www.iki.fi/pav/software/textext/index.html textext], re-editable LaTeX objects in Inkscape
 
+
* [http://www.kono.cis.iwate-u.ac.jp/~arakit/inkscape/inklatex.html InkLaTeX], simple drawing LaTeX text on Inkscape
 
+
* [http://sourceforge.net/projects/animeasy animEasy], easy 2D animations
 
 
For examples of API functions, see the perl SVG, SVG::DOM, et al modules
 
  
 
=== Inkscape Extension Archive Network ===
 
=== Inkscape Extension Archive Network ===
Line 70: Line 90:
 
   * Like freshmeat/sourceforge, report on # downloads, vitality, etc.
 
   * Like freshmeat/sourceforge, report on # downloads, vitality, etc.
  
 +
=== Extension Architechture Feature Wishlist ===
 +
* View stderr for external processes on failure (DONE)
 +
* Report reason (what deps are missing) for being disabled on attempted use
 +
* multiline text input widget
 +
* enumerated values input widget (dropdownlistbox) (would make effects more self documenting in some cases)
 +
* mutually exclusive parameter groups (tabbed notebooks)
 +
* multiline text label for use instructions
 +
* consider extension API rework. Current problems: possible perfomance issues because file IO and full document parsing at extension end. Also, access to internal inkscape functions is limited to invoking another copy of inkscape, wich leads again to long execution times and lack of flexibility. Proposed change: two-way communication via stdin/stdout in XML protocol, wich must allow partial document modification and allow access to inkscape internal functions, such as bounding box calculation, bezier curves subdivision, etc.
  
=== Proposals ===
+
=== See Also ===
 +
* [[ScriptingHOWTO]]
 +
* [http://sourceforge.net/mailarchive/message.php?msg_id=2057634 Ted's Plug-in Research from [[SodiPodi]]]
  
Are there any proposals yet?
+
[[Category:Developer Discussion]]
 +
[[Category:Extensions]]
 +
[[Category:Wiki Attic]]

Latest revision as of 05:53, 13 July 2016

Please place your extension architecture proposals here. Everyone will review them and we will decided a course of action after we release 0.38.

Tasks

Design Phase:

  • Flesh out each category of functions in the API with ideas for what the functions should be
  • Solidify the underlying Extension infrastructure [Ted]
  • Create an example Extension package
  • Write a specification document, including:
    • Overview of Inkscape Extensions
    • Creating an Extension
    • Registering an Extension
    • Custom Extension Preferences
    • Extension API Definition

Implementation Phase:

  • Implement Extension API
  • Implement an Extension registry
  • Create Extension preferences dialog
  • Create web tool for contributing new Extensions


Requirements

We would like the extension system to provide the following capabilities:

  • Uses a general language binding system so it's easy to add new language binding support
  • Allows direct interaction with the document object model including changing styles, adding/removing defs and elements, etc.
  • Allows some limited interaction with the Inkscape UI such as manipulating grids, overlays, etc.
  • Allows direct interaction with file load/save/export/print subsystem
  • Guaranteed to work properly with the undo system, even if the extension is not written carefully
  • Well documented so is easy for people to learn how to make new extensions
  • Each plugin can be implemented, distributed, and managed independently of the core project
  • Should be easy to start learning how to create new plugins
  • Icons, buttons, and other UI elements for plugins fit seamlessly into main application GUI
  • User can easily select which plugins to automatically load into application at startup
  • Loading of plugins shall not seriously slow startup time or make a major impact on memory footprint
  • Failure of a plugin shall not leave the drawing in an inconsistent state
  • Main application must gracefully recover from plugin crashes or other serious problems with plugin execution
  • Dependencies for particular plugins must be clearly identified for user if missing

Extension ideas

  • Plugin to send image to sign making peripherals like the Graphtec or Summa vinyl cutters' and printers'. Adobe Illustrator has such a thing so why not Insckape too?:)
  • Cross stitch generator (http://hawthorn.csse.monash.edu.au/~njh/programming/cross-stitch/)
  • Celtic knot editor: Using the standard winding number algorithm for Celtic knots build an interactive editor that forms the basic structure of the knots, allowing the user to edit the curve once generated. (Possible issue - getting the over/under rules correct) Douglas Zongker's Celtic Knot Thingy is a possible resource: http://isotropic.org/uw/knot/
  • mail-merge
  • Integrate a capture of a Blender3D frame and then process that bitmap. From a Blender-viewer window? From a simpler viewer? Not from a screen capture...higher resolution is desired...
  • Socket connection to other apps instead of file-based, where the state of socket connections will be autosaved and restorable after a crash...(since such on the fly work may not be easy to recreate then)
  • 3-d rotate - this is a really cool Kai (Kai's Vector Tools/Effects) plug-in for Illustrator
  • Inkify - it would be cool to have a plug-in that would take a normal object and make it look like it was drawn with ink.
  • Copy Adobe Illustrator's filters (punkify, bloat, calligraphize, etc)
  • Copy Dia's plugins
  • Look at Karbon14's plugins
  • PDF and Postscript import that converts all the type into lines as well as the included postscript vector objects and bitmaps
  • Randomize Size and Rotation of Objects
  • Create Cluster of objects from one seed with variable quantity, random distribution (noise types, gaussian, etc), variable rotation, opacity, and size
  • Zoom effect on shapes. Create an option where a zoom-like effect can be applied to a shape or set of shapes where more shapes are made larger and larger from the central anchor point of the shape(s) passed to this plugin
  • Color effects: Invert, Desaturate, etc. http://gimp-savvy.com/BOOK/index.html?node54.html

Existing extensions not bundled with Inkscape

  • Trace Setup, prepares a document for tracing a bitmap image
  • textext, re-editable LaTeX objects in Inkscape
  • InkLaTeX, simple drawing LaTeX text on Inkscape
  • animEasy, easy 2D animations

Inkscape Extension Archive Network

Initially, distributing extensions with Inkscape itself will be okay but ultimately for them to truly be extensions they should exist external to the core Inkscape project, which means we need some way to receive and manage contributions. Perl's CPAN provides an excellent model for how this type of module-contribution system can be made to work. Some important characteristics of CPAN worth adopting here:

  * Indexes of best items are available (e.g. 'best of')
  * Redundant modules are tolerated
  * Automate testing of included test suites on various platforms
  * Naming requirements to be included in indexes
  * Removal of malicious items
  * Manual application for user id on the system
  * Documentation for each module is online and nicely formatted
  * Integrated bug tracking system
  * Need to divide 'development' and 'stable'
  * Need to identify poor style, over-complexity.
  * Feedback to author should be personal so avoids public ranting
  * Use of review forms instead of freeform feedback?
  * Use of per-module discussion forums?
  * Establish forum for thanks and positive feedback
  * Like freshmeat/sourceforge, report on # downloads, vitality, etc.

Extension Architechture Feature Wishlist

  • View stderr for external processes on failure (DONE)
  • Report reason (what deps are missing) for being disabled on attempted use
  • multiline text input widget
  • enumerated values input widget (dropdownlistbox) (would make effects more self documenting in some cases)
  • mutually exclusive parameter groups (tabbed notebooks)
  • multiline text label for use instructions
  • consider extension API rework. Current problems: possible perfomance issues because file IO and full document parsing at extension end. Also, access to internal inkscape functions is limited to invoking another copy of inkscape, wich leads again to long execution times and lack of flexibility. Proposed change: two-way communication via stdin/stdout in XML protocol, wich must allow partial document modification and allow access to inkscape internal functions, such as bounding box calculation, bezier curves subdivision, etc.

See Also