summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2007-08-19 12:24:42 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2007-08-19 12:24:42 +0000
commit16ae1d036e63a8f5ccc6d18048c8fee517e3a814 (patch)
tree3f1fc5285ae4e7f9f3ebabc849988d463a6d331d /src
parentFixed a typo and an off-by-one error (diff)
downloadinkscape-16ae1d036e63a8f5ccc6d18048c8fee517e3a814.tar.gz
inkscape-16ae1d036e63a8f5ccc6d18048c8fee517e3a814.zip
forgot to add lpe-skeleton files to SVN...
(bzr r3522)
Diffstat (limited to 'src')
-rw-r--r--src/live_effects/lpe-skeleton.cpp109
-rw-r--r--src/live_effects/lpe-skeleton.h47
2 files changed, 156 insertions, 0 deletions
diff --git a/src/live_effects/lpe-skeleton.cpp b/src/live_effects/lpe-skeleton.cpp
new file mode 100644
index 000000000..a30a3c714
--- /dev/null
+++ b/src/live_effects/lpe-skeleton.cpp
@@ -0,0 +1,109 @@
+#define INKSCAPE_LPE_SKELETON_CPP
+/** \file
+ * SVG <skeleton> implementation, used as an example for a base starting class
+ * when implementing new LivePathEffects.
+ *
+ * In vi, three global search-and-replaces will let you rename everything
+ * in this and the .h file:
+ *
+ * :%s/SKELETON/YOURNAME/g
+ * :%s/Skeleton/Yourname/g
+ * :%s/skeleton/yourname/g
+ */
+/*
+ * Authors:
+ * Johan Engelen
+*
+* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-skeleton.h"
+#include "display/curve.h"
+#include <libnr/n-art-bpath.h>
+
+// You might need to include other 2geom files. You can add them here:
+#include <2geom/path.h>
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :
+ Effect(lpeobject),
+ // initialise your parameters here:
+ number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)
+{
+ // register all your parameters here, so Inkscape knows which parameters this effect has:
+ registerParameter( dynamic_cast<Parameter *>(&number) );
+}
+
+LPESkeleton::~LPESkeleton()
+{
+
+}
+
+
+/* ########################
+ * Choose to implement one of the doEffect functions. You can delete or comment out the others.
+*/
+
+/*
+void
+LPESkeleton::doEffect (SPCurve * curve)
+{
+ // spice this up to make the effect actually *do* something!
+}
+
+NArtBpath *
+LPESkeleton::doEffect (NArtBpath * path_in)
+{
+ NArtBpath *path_out;
+ unsigned ret = 0;
+ while ( path_in[ret].code != NR_END ) {
+ ++ret;
+ }
+ unsigned len = ++ret;
+ path_out = g_new(NArtBpath, len);
+
+ memcpy(path_out, path_in, len * sizeof(NArtBpath)); // spice this up to make the effect actually *do* something!
+
+ return path_out;
+}
+
+std::vector<Geom::Path>
+LPESkeleton::doEffect (std::vector<Geom::Path> & path_in)
+{
+ std::vector<Geom::Path> path_out;
+
+ path_out = path_in; // spice this up to make the effect actually *do* something!
+
+ return path_out;
+}
+*/
+
+Geom::Piecewise<Geom::D2<Geom::SBasis> >
+LPESkeleton::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
+{
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
+
+ output = pwd2_in; // spice this up to make the effect actually *do* something!
+
+ return output;
+}
+
+/* ######################## */
+
+}; //namespace LivePathEffect
+}; /* namespace Inkscape */
+
+/*
+ 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 :
diff --git a/src/live_effects/lpe-skeleton.h b/src/live_effects/lpe-skeleton.h
new file mode 100644
index 000000000..cefbf0a0b
--- /dev/null
+++ b/src/live_effects/lpe-skeleton.h
@@ -0,0 +1,47 @@
+#ifndef INKSCAPE_LPE_SKELETON_H
+#define INKSCAPE_LPE_SKELETON_H
+
+/** \file
+ * SVG <skeleton> implementation, see sp-skeleton.cpp.
+ */
+
+/*
+ * Authors:
+ * Johan Engelen
+*
+* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/effect.h"
+#include "live_effects/parameter/parameter.h"
+#include "live_effects/parameter/point.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+class LPESkeleton : public Effect {
+public:
+ LPESkeleton(LivePathEffectObject *lpeobject);
+ ~LPESkeleton();
+
+// Choose to implement one of the doEffect functions. You can delete or comment out the others.
+// void doEffect (SPCurve * curve);
+// NArtBpath * doEffect (NArtBpath * path_in);
+// std::vector<Geom::Path> doEffect (std::vector<Geom::Path> & path_in);
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in);
+
+private:
+ // add the parameters for your effect here:
+ RealParam number;
+ // there are all kinds of parameters. Check the /live_effects/parameter directory which types exist!
+
+ LPESkeleton(const LPESkeleton&);
+ LPESkeleton& operator=(const LPESkeleton&);
+};
+
+} //namespace LivePathEffect
+} //namespace Inkscape
+
+#endif