1 #define INKSCAPE_LPE_SLANT_CPP
3 /*
4 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
5 *
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #include "live_effects/lpe-slant.h"
10 #include "display/curve.h"
11 #include <libnr/n-art-bpath.h>
13 namespace Inkscape {
14 namespace LivePathEffect {
16 LPESlant::LPESlant(LivePathEffectObject *lpeobject) :
17 Effect(lpeobject),
18 factor(_("Slant factor"), _("y = y + x*(slant factor)"), "factor", &wr, this),
19 center(_("Center"), _("The x-coord of this point is around which the slant will happen"), "center", &wr, this)
20 {
21 registerParameter( dynamic_cast<Parameter *>(&factor) );
22 registerParameter( dynamic_cast<Parameter *>(¢er) );
23 }
25 LPESlant::~LPESlant()
26 {
27 }
29 void
30 LPESlant::doEffect(SPCurve * curve)
31 {
32 NArtBpath *bpath = curve->_bpath;
33 int i = 0;
34 while(bpath[i].code != NR_END) {
35 bpath[i].y1 += (bpath[i].x1-center[Geom::X]) * factor;
36 bpath[i].y2 += (bpath[i].x2-center[Geom::X]) * factor;
37 bpath[i].y3 += (bpath[i].x3-center[Geom::X]) * factor;
38 i++;
39 }
41 }
43 }; //namespace LivePathEffect
44 }; /* namespace Inkscape */
46 /*
47 Local Variables:
48 mode:c++
49 c-file-style:"stroustrup"
50 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
51 indent-tabs-mode:nil
52 fill-column:99
53 End:
54 */
55 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :