Code

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