diff options
| author | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-07-14 20:55:43 +0000 |
|---|---|---|
| committer | nicholasbishop <nicholasbishop@users.sourceforge.net> | 2007-07-14 20:55:43 +0000 |
| commit | 28d142f1596cfa9e4dd6b63509205d528394c779 (patch) | |
| tree | f0285a821f510a0193ff2c78bd5e6627e3c2f075 /src/filter-chemistry.cpp | |
| parent | Move check for unlinked paths of 3D box faces to the correct location (diff) | |
| download | inkscape-28d142f1596cfa9e4dd6b63509205d528394c779.tar.gz inkscape-28d142f1596cfa9e4dd6b63509205d528394c779.zip | |
Filter effects:
* As coded by Johan Engelen, made the filter-effect-enums code more generic; the data and conversion classes are now in src/util, filter-specific data is in filter-enums.h
* Improved filter_add_primitive so that default values are filled in appropriately to prevent errors or possible crashes
(bzr r3241)
Diffstat (limited to 'src/filter-chemistry.cpp')
| -rw-r--r-- | src/filter-chemistry.cpp | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index e59036362..d9bf33d60 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -18,6 +18,9 @@ #include "document-private.h" #include "desktop-style.h" +#include "filter-chemistry.h" +#include "filter-enums.h" + #include "sp-feblend.h" #include "sp-filter.h" #include "sp-filter-reference.h" @@ -111,15 +114,57 @@ SPFilter *new_filter(SPDocument *document) } SPFilterPrimitive * -filter_add_primitive(SPFilter *filter, const gchar *type) +filter_add_primitive(SPFilter *filter, const NR::FilterPrimitiveType type) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(filter->document); //create filter primitive node Inkscape::XML::Node *repr; - repr = xml_doc->createElement(type); + repr = xml_doc->createElement(FPConverter.get_key(type).c_str()); repr->setAttribute("inkscape:collect", "always"); + // set default values + switch(type) { + case NR::NR_FILTER_BLEND: + repr->setAttribute("blend", "normal"); + break; + case NR::NR_FILTER_COLORMATRIX: + break; + case NR::NR_FILTER_COMPONENTTRANSFER: + break; + case NR::NR_FILTER_COMPOSITE: + break; + case NR::NR_FILTER_CONVOLVEMATRIX: + break; + case NR::NR_FILTER_DIFFUSELIGHTING: + break; + case NR::NR_FILTER_DISPLACEMENTMAP: + break; + case NR::NR_FILTER_FLOOD: + break; + case NR::NR_FILTER_GAUSSIANBLUR: + repr->setAttribute("stddeviation", "1"); + break; + case NR::NR_FILTER_IMAGE: + break; + case NR::NR_FILTER_MERGE: + break; + case NR::NR_FILTER_MORPHOLOGY: + break; + case NR::NR_FILTER_OFFSET: + repr->setAttribute("dx", "0"); + repr->setAttribute("dy", "0"); + break; + case NR::NR_FILTER_SPECULARLIGHTING: + break; + case NR::NR_FILTER_TILE: + break; + case NR::NR_FILTER_TURBULENCE: + break; + default: + break; + } + //set primitive as child of filter node filter->repr->appendChild(repr); Inkscape::GC::release(repr); |
