diff options
| author | Niko Kiirala <niko@kiirala.com> | 2007-05-29 10:47:04 +0000 |
|---|---|---|
| committer | kiirala <kiirala@users.sourceforge.net> | 2007-05-29 10:47:04 +0000 |
| commit | bb8c80451efac613442f77de66d246065ffa4fcf (patch) | |
| tree | 61128cfdaedcc105fd1cb0861e0583a9cee47690 /src/sp-filter.cpp | |
| parent | Add auto gap filling for Paint Bucket and implement "safety valve" to prevent... (diff) | |
| download | inkscape-bb8c80451efac613442f77de66d246065ffa4fcf.tar.gz inkscape-bb8c80451efac613442f77de66d246065ffa4fcf.zip | |
Added support for in-parameter in filter primitives
(bzr r3041)
Diffstat (limited to 'src/sp-filter.cpp')
| -rw-r--r-- | src/sp-filter.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index ac0d3d29e..43f2dc9d2 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -17,6 +17,11 @@ # include "config.h" #endif +#include <map> +#include <string.h> +using std::map; +using std::pair; + #include "attributes.h" #include "document.h" #include "sp-filter.h" @@ -454,6 +459,31 @@ int sp_filter_primitive_count(SPFilter *filter) { return filter->_primitive_count; } +int sp_filter_get_image_name(SPFilter *filter, gchar const *name) { + gchar *name_copy = strdup(name); + map<gchar *, int, ltstr>::iterator result = filter->_image_name.find(name_copy); + free(name_copy); + if (result == filter->_image_name.end()) return -1; + else return (*result).second; +} + +int sp_filter_set_image_name(SPFilter *filter, gchar const *name) { + int value = filter->_image_number_next; + filter->_image_number_next++; + gchar *name_copy = strdup(name); + pair<map<gchar*,int,ltstr>::iterator,bool> ret = filter->_image_name.insert(pair<gchar*,int>(name_copy, value)); + if (ret.second == false) { + return (*ret.first).second; + } + return value; +} + +bool ltstr::operator()(const char* s1, const char* s2) const +{ + return strcmp(s1, s2) < 0; +} + + /* Local Variables: mode:c++ |
