1 /*
2 * Authors:
3 * Ted Gould <ted@gould.cx>
4 *
5 * Copyright (C) 2006 Authors
6 *
7 * Released under GNU GPL, read the file 'COPYING' for more information
8 */
10 #include "patheffect.h"
11 #include "db.h"
13 namespace Inkscape {
14 namespace Extension {
16 PathEffect::PathEffect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
17 : Extension(in_repr, in_imp)
18 {
20 }
22 PathEffect::~PathEffect (void)
23 {
25 }
27 void
28 PathEffect::processPath (SPDocument * doc, Inkscape::XML::Node * path, Inkscape::XML::Node * def)
29 {
32 }
34 void
35 PathEffect::processPathEffects (SPDocument * doc, Inkscape::XML::Node * path)
36 {
37 gchar const * patheffectlist = path->attribute("inkscape:path-effects");
38 if (patheffectlist == NULL)
39 return;
41 gchar ** patheffects = g_strsplit(patheffectlist, ";", 128);
42 Inkscape::XML::Node * defs;
44 for (int i = 0; patheffects[i] != NULL && i < 128; i++) {
45 gchar * patheffect = patheffects[i];
47 // This is weird, they should all be references... but anyway
48 if (patheffect[0] != '#') continue;
50 Inkscape::XML::Node * prefs = sp_repr_lookup_child(defs, "id", &(patheffect[1]));
51 if (prefs == NULL) {
53 continue;
54 }
56 gchar const * ext_id = prefs->attribute("extension");
57 if (ext_id == NULL) {
59 continue;
60 }
62 Inkscape::Extension::PathEffect * peffect;
63 peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id));
64 if (peffect != NULL) {
66 continue;
67 }
69 peffect->processPath(doc, path, prefs);
70 }
72 g_strfreev(patheffects);
73 return;
74 }
77 } } /* namespace Inkscape, Extension */
79 /*
80 Local Variables:
81 mode:c++
82 c-file-style:"stroustrup"
83 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
84 indent-tabs-mode:nil
85 fill-column:99
86 End:
87 */
88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :