summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a66bad)
raw | patch | inline | side by side (parent: 5a66bad)
| author | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:28:38 +0000 (05:28 +0000) | ||
| committer | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:28:38 +0000 (05:28 +0000) |
Adding in a static function to process all the path effects on a
particular node. It breaks down the list and looks them each up --
calling each one as it goes.
particular node. It breaks down the list and looks them each up --
calling each one as it goes.
| src/extension/patheffect.cpp | patch | blob | history | |
| src/extension/patheffect.h | patch | blob | history |
index 9e94a565459df186f8957d202fff0af097e25928..f6ff273fa98509ccd7adea6380308696bba07fa9 100644 (file)
*/
#include "patheffect.h"
+#include "db.h"
namespace Inkscape {
namespace Extension {
}
void
-PathEffect::processPath (Inkscape::XML::Node * node)
+PathEffect::processPath (SPDocument * doc, Inkscape::XML::Node * path, Inkscape::XML::Node * def)
{
}
+void
+PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path)
+{
+ gchar const * patheffectlist = path->attribute("inkscape:path-effects");
+ if (patheffectlist == NULL)
+ return;
+
+ gchar ** patheffects = g_strsplit(patheffectlist, ";", 128);
+ Inkscape::XML::Node * defs;
+
+ for (int i = 0; patheffects[i] != NULL && i < 128; i++) {
+ gchar * patheffect = patheffects[i];
+
+ // This is weird, they should all be references... but anyway
+ if (patheffect[0] != '#') continue;
+
+ Inkscape::XML::Node * prefs = sp_repr_lookup_child(defs, "id", &(patheffect[1]));
+ if (prefs == NULL) {
+
+ continue;
+ }
+
+ gchar const * ext_id = prefs->attribute("extension");
+ if (ext_id == NULL) {
+
+ continue;
+ }
+
+ Inkscape::Extension::PathEffect * peffect;
+ peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id));
+ if (peffect != NULL) {
+
+ continue;
+ }
+
+ peffect->processPath(doc, path, prefs);
+ }
+
+ g_strfreev(patheffects);
+ return;
+}
+
} } /* namespace Inkscape, Extension */
index ca4134d3883458c7ae418559eb0c7b069e5f2c9a..0c00ae093ab8a783ea6e90a90eb59239029722fc 100644 (file)
#ifndef INKSCAPE_EXTENSION_PATHEFFECT_H__
#define INKSCAPE_EXTENSION_PATHEFFECT_H__
+#include "document.h"
#include "extension.h"
namespace Inkscape {
PathEffect (Inkscape::XML::Node * in_repr,
Implementation::Implementation * in_imp);
virtual ~PathEffect (void);
- void processPath (Inkscape::XML::Node * node);
-
+ void processPath (SPDocument * doc,
+ Inkscape::XML::Node * path,
+ Inkscape::XML::Node * def);
+ static void processPathEffects (SPDocument * doc,
+ Inkscape::XML::Node * path);
}; /* PathEffect */