Code

tidy up
[inkscape.git] / src / live_effects / lpe-skeleton.cpp
1 #define INKSCAPE_LPE_SKELETON_CPP\r
2 /** \file\r
3  * SVG <skeleton> implementation, used as an example for a base starting class\r
4  * when implementing new LivePathEffects.\r
5  *\r
6  * In vi, three global search-and-replaces will let you rename everything\r
7  * in this and the .h file:\r
8  *\r
9  *   :%s/SKELETON/YOURNAME/g\r
10  *   :%s/Skeleton/Yourname/g\r
11  *   :%s/skeleton/yourname/g\r
12  */\r
13 /*\r
14  * Authors:\r
15  *   Johan Engelen\r
16 *\r
17 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>\r
18  *\r
19  * Released under GNU GPL, read the file 'COPYING' for more information\r
20  */\r
21 \r
22 #include "live_effects/lpe-skeleton.h"\r
23 #include "display/curve.h"\r
24 #include <libnr/n-art-bpath.h>\r
25 \r
26 // You might need to include other 2geom files. You can add them here:\r
27 #include <2geom/path.h>\r
28 \r
29 namespace Inkscape {\r
30 namespace LivePathEffect {\r
31 \r
32 LPESkeleton::LPESkeleton(LivePathEffectObject *lpeobject) :\r
33     Effect(lpeobject),\r
34     // initialise your parameters here:\r
35     number(_("Float parameter"), _("just a real number like 1.4!"), "svgname", &wr, this, 1.2)\r
36 {\r
37     // register all your parameters here, so Inkscape knows which parameters this effect has:\r
38     registerParameter( dynamic_cast<Parameter *>(&number) );\r
39 }\r
40 \r
41 LPESkeleton::~LPESkeleton()\r
42 {\r
43 \r
44 }\r
45 \r
46 \r
47 /* ########################\r
48  *  Choose to implement one of the doEffect functions. You can delete or comment out the others.\r
49 */\r
50 \r
51 /*\r
52 void\r
53 LPESkeleton::doEffect (SPCurve * curve)\r
54 {\r
55     // spice this up to make the effect actually *do* something!\r
56 }\r
57 \r
58 NArtBpath *\r
59 LPESkeleton::doEffect (NArtBpath * path_in)\r
60 {\r
61         NArtBpath *path_out;\r
62         unsigned ret = 0;\r
63         while ( path_in[ret].code != NR_END ) {\r
64             ++ret;\r
65         }\r
66         unsigned len = ++ret;\r
67         path_out = g_new(NArtBpath, len);\r
68 \r
69         memcpy(path_out, path_in, len * sizeof(NArtBpath));   // spice this up to make the effect actually *do* something!\r
70 \r
71         return path_out;\r
72 }\r
73 \r
74 std::vector<Geom::Path>\r
75 LPESkeleton::doEffect (std::vector<Geom::Path> & path_in)\r
76 {\r
77         std::vector<Geom::Path> path_out;\r
78 \r
79         path_out = path_in;   // spice this up to make the effect actually *do* something!\r
80 \r
81         return path_out;\r
82 }\r
83 */\r
84 \r
85 Geom::Piecewise<Geom::D2<Geom::SBasis> >\r
86 LPESkeleton::doEffect (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)\r
87 {\r
88     Geom::Piecewise<Geom::D2<Geom::SBasis> > output;\r
89 \r
90     output = pwd2_in;   // spice this up to make the effect actually *do* something!\r
91 \r
92     return output;\r
93 }\r
94 \r
95 /* ######################## */\r
96 \r
97 } //namespace LivePathEffect\r
98 } /* namespace Inkscape */\r
99 \r
100 /*\r
101   Local Variables:\r
102   mode:c++\r
103   c-file-style:"stroustrup"\r
104   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
105   indent-tabs-mode:nil\r
106   fill-column:99\r
107   End:\r
108 */\r
109 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :\r