c0fe0adc03e3cd9814b222019f23a2ead6dc002f
1 #define INKSCAPE_LPE_SKELETON_CPP
2 /** \file
3 * SVG <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"
23 #include "display/curve.h"
24 #include <libnr/n-art-bpath.h>
26 // You might need to include other 2geom files. You can add them here:
27 #include <2geom/path.h>
29 namespace Inkscape {
30 namespace LivePathEffect {
32 LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :
33 Effect(lpeobject),
34 // initialise your parameters here:
35 number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)
36 {
37 // register all your parameters here, so Inkscape knows which parameters this effect has:
38 registerParameter( dynamic_cast<Parameter *>(&number) );
39 }
41 LPESkeleton::~LPESkeleton()
42 {
44 }
47 /* ########################
48 * Choose to implement one of the doEffect functions. You can delete or comment out the others.
49 */
51 /*
52 void
53 LPESkeleton::doEffect (SPCurve * curve)
54 {
55 // spice this up to make the effect actually *do* something!
56 }
58 NArtBpath *
59 LPESkeleton::doEffect_nartbpath (NArtBpath * path_in)
60 {
61 NArtBpath *path_out;
62 unsigned ret = 0;
63 while ( path_in[ret].code != NR_END ) {
64 ++ret;
65 }
66 unsigned len = ++ret;
67 path_out = g_new(NArtBpath, len);
69 memcpy(path_out, path_in, len * sizeof(NArtBpath)); // spice this up to make the effect actually *do* something!
71 return path_out;
72 }
74 std::vector<Geom::Path>
75 LPESkeleton::doEffect_path (std::vector<Geom::Path> & path_in)
76 {
77 std::vector<Geom::Path> path_out;
79 path_out = path_in; // spice this up to make the effect actually *do* something!
81 return path_out;
82 }
83 */
85 Geom::Piecewise<Geom::D2<Geom::SBasis> >
86 LPESkeleton::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
87 {
88 Geom::Piecewise<Geom::D2<Geom::SBasis> > output;
90 output = pwd2_in; // spice this up to make the effect actually *do* something!
92 return output;
93 }
95 /* ######################## */
97 } //namespace LivePathEffect
98 } /* namespace Inkscape */
100 /*
101 Local Variables:
102 mode:c++
103 c-file-style:"stroustrup"
104 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
105 indent-tabs-mode:nil
106 fill-column:99
107 End:
108 */
109 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :