1 #define INKSCAPE_LPE_SKELETON_CPP
2 /** \file
3 * LPE <skeleton> implementation, used as an example for a base starting class
4 * when implementing new LivePathEffects.
5 *
6 * In vi, three global search-and-replaces will let you rename everything
7 * in this and the .h file:
8 *
9 * :%s/SKELETON/YOURNAME/g
10 * :%s/Skeleton/Yourname/g
11 * :%s/skeleton/yourname/g
12 */
13 /*
14 * Authors:
15 * Johan Engelen
16 *
17 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
18 *
19 * Released under GNU GPL, read the file 'COPYING' for more information
20 */
22 #include "live_effects/lpe-skeleton.h"
24 // You might need to include other 2geom files. You can add them here:
25 #include <2geom/path.h>
27 namespace Inkscape {
28 namespace LivePathEffect {
30 LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :
31 Effect(lpeobject),
32 // initialise your parameters here:
33 number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)
34 {
35 /* uncomment the following line to have the original path displayed while the item is selected */
36 //show_orig_path = true;
38 /* register all your parameters here, so Inkscape knows which parameters this effect has: */
39 registerParameter( dynamic_cast<Parameter *>(&number) );
41 /* register all your knotholder handles here: */
42 //registerKnotHolderHandle(new Skeleton::KnotHolderEntityAttachMyHandle(), _("help message"));
43 }
45 LPESkeleton::~LPESkeleton()
46 {
48 }
51 /* ########################
52 * Choose to implement one of the doEffect functions. You can delete or comment out the others.
53 */
55 /*
56 void
57 LPESkeleton::doEffect (SPCurve * curve)
58 {
59 // spice this up to make the effect actually *do* something!
60 }
62 std::vector<Geom::Path>
63 LPESkeleton::doEffect_path (std::vector<Geom::Path> const & path_in)
64 {
65 std::vector<Geom::Path> path_out;
67 path_out = path_in; // spice this up to make the effect actually *do* something!
69 return path_out;
70 }
71 */
73 Geom::Piecewise<Geom::D2<Geom::SBasis> >
74 LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
75 {
76 Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
78 output = pwd2_in; // spice this up to make the effect actually *do* something!
80 return output;
81 }
83 /* ########################
84 * Define the classes for your knotholder handles here
85 */
87 /**
88 namespace Skeleton {
90 class KnotHolderEntityMyHandle : public LPEKnotHolderEntity
91 {
92 public:
93 // the set() and get() methods must be implemented, click() is optional
94 virtual void knot_set(NR::Point const &p, NR::Point const &origin, guint state);
95 virtual NR::Point knot_get();
96 //virtual void knot_click(guint state);
97 };
99 } // namespace Skeleton
100 **/
102 /* ######################## */
104 } //namespace LivePathEffect
105 } /* namespace Inkscape */
107 /*
108 Local Variables:
109 mode:c++
110 c-file-style:"stroustrup"
111 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
112 indent-tabs-mode:nil
113 fill-column:99
114 End:
115 */
116 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :