summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-05-02 05:28:38 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-05-02 05:28:38 +0000
commitdd486e24d15e93887748da1a960eac86c1336053 (patch)
tree6dc33ba442315c7663e77a031b0248bbb4cabe9f /src
parentr11517@tres: ted | 2006-04-28 22:20:06 -0700 (diff)
downloadinkscape-dd486e24d15e93887748da1a960eac86c1336053.tar.gz
inkscape-dd486e24d15e93887748da1a960eac86c1336053.zip
r11518@tres: ted | 2006-04-28 22:21:01 -0700
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. (bzr r688)
Diffstat (limited to 'src')
-rw-r--r--src/extension/patheffect.cpp45
-rw-r--r--src/extension/patheffect.h8
2 files changed, 50 insertions, 3 deletions
diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp
index 9e94a5654..f6ff273fa 100644
--- a/src/extension/patheffect.cpp
+++ b/src/extension/patheffect.cpp
@@ -8,6 +8,7 @@
*/
#include "patheffect.h"
+#include "db.h"
namespace Inkscape {
namespace Extension {
@@ -24,12 +25,54 @@ PathEffect::~PathEffect (void)
}
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 */
diff --git a/src/extension/patheffect.h b/src/extension/patheffect.h
index ca4134d38..0c00ae093 100644
--- a/src/extension/patheffect.h
+++ b/src/extension/patheffect.h
@@ -10,6 +10,7 @@
#ifndef INKSCAPE_EXTENSION_PATHEFFECT_H__
#define INKSCAPE_EXTENSION_PATHEFFECT_H__
+#include "document.h"
#include "extension.h"
namespace Inkscape {
@@ -21,8 +22,11 @@ public:
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 */