Difference between revisions of "Filter Effects"

From Inkscape Wiki
Jump to navigation Jump to search
(+SoC link)
Line 1: Line 1:
Filter effects is a part of [http://www.w3.org/TR/SVG11/filters.html SVG specification] and worked on in Inkscape as part of [[Googles_Summer_Of_Code]] 2006
Filter effects is a part of [http://www.w3.org/TR/SVG11/filters.html SVG specification] and worked on in Inkscape as part of [[Googles_Summer_Of_Code]] 2006


NB: At the moment, Inkscape filter effects support is '''highly experimental'''
== What works? ==


== What works? ==
Basic support for filter effects is included in SVN trunk and in upcoming 0.45 release. At the moment only gaussian blur is implemented, so while specifications define a bunch of other effects and some other programs can handle them, Inkscape cannot render them yet. Also, tools for editing other types of filters do not exist yet.
 
Gaussian blur can be applied to an object by using Blur slider in Fill and stroke dialog.


Filter effects are parsed from svg documents. A constant size gaussian blur is applied to objects that have filter-property set and it references to existing filter-element in the same document.
In Inkscape preferences dialog there is a setting controlling the filter rendering quality. Even low quality often produces good enough rendering quality, but it takes a lot less time to render. When exporting an image from Inkscape, the best quality is always used, regardless of this setting.


== How to make it work ==
== What next? ==


Preliminary filter effects support is now included in inkscape subversion reposistory.
Now that this one filter works, most of the basic framework needed for filtering exists.


There is no GUI to create filters or to attach them to objects. You have to do that with the XML editor in inkscape, for example.
These are the basic steps to create a new filter primitive:
* Edit -> XML Editor
* Write a new document model level class for this filter primitive (see src/sp-gaussian-blur.cpp)
* Select the svg:defs -element
* Write a renderer for this filter primitive (see src/display/nr-filter-gaussian.cpp)
* Click 'New element node'
* Add a pointer to a function returning an instance of the renderer class to function Filter::_create_constructor_table in file src/display/nr-filter.cpp
* Type svg:filter as node type
(this is likely not an exhaustive list)
* Change the id if you wish. I'll call the id 'xyzzy'
* Pick the object you wish to apply filtering to
* In XML editor, add new property for this object with name 'filter' and value of 'url(#xyzzy)'


Blur radius is read from inkscape configuration file, from attribute options.filtertest. See [[HandlingPreferences]] for info on how to add that attribute.
Before new filter primitives can be useful, there has to be an user interface for applying them to shapes. A really good thing would also be an UI for creating filters out of filter primitives.


[[Category:Developer_Documentation]]
[[Category:Developer_Documentation]]

Revision as of 18:00, 18 December 2006

Filter effects is a part of SVG specification and worked on in Inkscape as part of Googles_Summer_Of_Code 2006

What works?

Basic support for filter effects is included in SVN trunk and in upcoming 0.45 release. At the moment only gaussian blur is implemented, so while specifications define a bunch of other effects and some other programs can handle them, Inkscape cannot render them yet. Also, tools for editing other types of filters do not exist yet.

Gaussian blur can be applied to an object by using Blur slider in Fill and stroke dialog.

In Inkscape preferences dialog there is a setting controlling the filter rendering quality. Even low quality often produces good enough rendering quality, but it takes a lot less time to render. When exporting an image from Inkscape, the best quality is always used, regardless of this setting.

What next?

Now that this one filter works, most of the basic framework needed for filtering exists.

These are the basic steps to create a new filter primitive:

  • Write a new document model level class for this filter primitive (see src/sp-gaussian-blur.cpp)
  • Write a renderer for this filter primitive (see src/display/nr-filter-gaussian.cpp)
  • Add a pointer to a function returning an instance of the renderer class to function Filter::_create_constructor_table in file src/display/nr-filter.cpp

(this is likely not an exhaustive list)

Before new filter primitives can be useful, there has to be an user interface for applying them to shapes. A really good thing would also be an UI for creating filters out of filter primitives.