summaryrefslogtreecommitdiffstats
path: root/src/extension/patheffect.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/extension/patheffect.cpp
parentInitial commit. (diff)
downloadinkscape-upstream.tar.xz
inkscape-upstream.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/extension/patheffect.cpp')
-rw-r--r--src/extension/patheffect.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/extension/patheffect.cpp b/src/extension/patheffect.cpp
new file mode 100644
index 0000000..3ed53e7
--- /dev/null
+++ b/src/extension/patheffect.cpp
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Authors:
+ * Ted Gould <ted@gould.cx>
+ *
+ * Copyright (C) 2006 Authors
+ *
+ * Released under GNU GPL v2+, read the file 'COPYING' for more information.
+ */
+
+
+#include "patheffect.h"
+
+#include "db.h"
+
+#include "object/sp-defs.h"
+
+#include "xml/repr.h"
+
+
+namespace Inkscape {
+namespace Extension {
+
+PathEffect::PathEffect (Inkscape::XML::Node *in_repr, Implementation::Implementation *in_imp, std::string *base_directory)
+ : Extension(in_repr, in_imp, base_directory)
+{
+
+}
+
+PathEffect::~PathEffect (void)
+= default;
+
+void
+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 == nullptr)
+ return;
+
+ gchar ** patheffects = g_strsplit(patheffectlist, ";", 128);
+ Inkscape::XML::Node * defs = doc->getDefs()->getRepr();
+
+ for (int i = 0; (i < 128) && (patheffects[i] != nullptr); 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 == nullptr) {
+
+ continue;
+ }
+
+ gchar const * ext_id = prefs->attribute("extension");
+ if (ext_id == nullptr) {
+
+ continue;
+ }
+
+ Inkscape::Extension::PathEffect * peffect;
+ peffect = dynamic_cast<Inkscape::Extension::PathEffect *>(Inkscape::Extension::db.get(ext_id));
+ if (peffect != nullptr) {
+ peffect->processPath(doc, path, prefs);
+ }
+ }
+
+ g_strfreev(patheffects);
+ return;
+}
+
+
+} } /* namespace Inkscape, Extension */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :