index a30a3c71411979ffa061e2f3e20a70637a1bd59d..fdee68b88423bbf9d2421ed683c0eaab10b8173b 100644 (file)
-#define INKSCAPE_LPE_SKELETON_CPP\r
-/** \file\r
- * SVG <skeleton> implementation, used as an example for a base starting class\r
- * when implementing new LivePathEffects.\r
- *\r
- * In vi, three global search-and-replaces will let you rename everything\r
- * in this and the .h file:\r
- *\r
- * :%s/SKELETON/YOURNAME/g\r
- * :%s/Skeleton/Yourname/g\r
- * :%s/skeleton/yourname/g\r
- */\r
-/*\r
- * Authors:\r
- * Johan Engelen\r
-*\r
-* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>\r
- *\r
- * Released under GNU GPL, read the file 'COPYING' for more information\r
- */\r
-\r
-#include "live_effects/lpe-skeleton.h"\r
-#include "display/curve.h"\r
-#include <libnr/n-art-bpath.h>\r
-\r
-// You might need to include other 2geom files. You can add them here:\r
-#include <2geom/path.h>\r
-\r
-namespace Inkscape {\r
-namespace LivePathEffect {\r
-\r
-LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :\r
- Effect(lpeobject),\r
- // initialise your parameters here:\r
- number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)\r
-{\r
- // register all your parameters here, so Inkscape knows which parameters this effect has:\r
- registerParameter( dynamic_cast<Parameter *>(&number) );\r
-}\r
-\r
-LPESkeleton::~LPESkeleton()\r
-{\r
-\r
-}\r
-\r
-\r
-/* ########################\r
- * Choose to implement one of the doEffect functions. You can delete or comment out the others.\r
-*/\r
-\r
-/*\r
-void\r
-LPESkeleton::doEffect (SPCurve * curve)\r
-{\r
- // spice this up to make the effect actually *do* something!\r
-}\r
-\r
-NArtBpath *\r
-LPESkeleton::doEffect (NArtBpath * path_in)\r
-{\r
- NArtBpath *path_out;\r
- unsigned ret = 0;\r
- while ( path_in[ret].code != NR_END ) {\r
- ++ret;\r
- }\r
- unsigned len = ++ret;\r
- path_out = g_new(NArtBpath, len);\r
-\r
- memcpy(path_out, path_in, len * sizeof(NArtBpath)); // spice this up to make the effect actually *do* something!\r
-\r
- return path_out;\r
-}\r
-\r
-std::vector<Geom::Path>\r
-LPESkeleton::doEffect (std::vector<Geom::Path> & path_in)\r
-{\r
- std::vector<Geom::Path> path_out;\r
-\r
- path_out = path_in; // spice this up to make the effect actually *do* something!\r
-\r
- return path_out;\r
-}\r
-*/\r
-\r
-Geom::Piecewise<Geom::D2<Geom::SBasis> >\r
-LPESkeleton::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)\r
-{\r
- Geom::Piecewise<Geom::D2<Geom::SBasis> > output;\r
-\r
- output = pwd2_in; // spice this up to make the effect actually *do* something!\r
-\r
- return output;\r
-}\r
-\r
-/* ######################## */\r
-\r
-}; //namespace LivePathEffect\r
-}; /* namespace Inkscape */\r
-\r
-/*\r
- Local Variables:\r
- mode:c++\r
- c-file-style:"stroustrup"\r
- c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
- indent-tabs-mode:nil\r
- fill-column:99\r
- End:\r
-*/\r
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r
+#define INKSCAPE_LPE_SKELETON_CPP
+/** \file
+ * @brief Minimal dummy LPE effect 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 <j.b.c.engelen@utwente.nl>
+ *
+ * Copyright (C) 2007 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-skeleton.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)
+{
+ /* uncomment the following line to have the original path displayed while the item is selected */
+ //show_orig_path = true;
+
+ /* register all your parameters here, so Inkscape knows which parameters this effect has: */
+ registerParameter( dynamic_cast<Parameter *>(&number) );
+
+ /* register all your knotholder handles here: */
+ //registerKnotHolderHandle(new Skeleton::KnotHolderEntityAttachMyHandle(), _("help message"));
+}
+
+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!
+}
+
+std::vector<Geom::Path>
+LPESkeleton::doEffect_path (std::vector<Geom::Path> const & 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_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
+{
+ Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
+
+ output = pwd2_in; // spice this up to make the effect actually *do* something!
+
+ return output;
+}
+
+/* ########################
+ * Define the classes for your knotholder handles here
+ */
+
+/*
+namespace Skeleton {
+
+class KnotHolderEntityMyHandle : public LPEKnotHolderEntity
+{
+public:
+ // the set() and get() methods must be implemented, click() is optional
+ virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state);
+ virtual Geom::Point knot_get();
+ //virtual void knot_click(guint state);
+};
+
+} // namespace Skeleton
+*/
+
+/* ######################## */
+
+} //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:encoding=utf-8:textwidth=99 :