diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-08-14 20:54:48 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-08-14 20:54:48 +0000 |
| commit | 55d43e4e27e0ba58a47fad70957dfa989aa173ad (patch) | |
| tree | 2ccfbac1c50023d08ae32975c876fa2478c1ad2a /src/live_effects/lpe-slant.cpp | |
| parent | Fix for bug #1752113; added set_preview_widget_active(false) to FileSaveDialo... (diff) | |
| download | inkscape-55d43e4e27e0ba58a47fad70957dfa989aa173ad.tar.gz inkscape-55d43e4e27e0ba58a47fad70957dfa989aa173ad.zip | |
Commit LivePathEffect branch to trunk!
(disabled extension/internal/bitmap/*.* in build.xml to fix compilation)
(bzr r3472)
Diffstat (limited to 'src/live_effects/lpe-slant.cpp')
| -rw-r--r-- | src/live_effects/lpe-slant.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/live_effects/lpe-slant.cpp b/src/live_effects/lpe-slant.cpp new file mode 100644 index 000000000..93107f81a --- /dev/null +++ b/src/live_effects/lpe-slant.cpp @@ -0,0 +1,62 @@ +#define INKSCAPE_LPE_SLANT_CPP
+
+/*
+ * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include "live_effects/lpe-slant.h"
+#include "sp-shape.h"
+#include "display/curve.h"
+#include <libnr/n-art-bpath.h>
+#include "live_effects/n-art-bpath-2geom.h"
+
+#include <2geom/path.h>
+#include <2geom/transforms.h>
+
+#include "svg/svg.h"
+
+namespace Inkscape {
+namespace LivePathEffect {
+
+LPESlant::LPESlant(LivePathEffectObject *lpeobject) :
+ Effect(lpeobject),
+ factor(_("Slant factor"), _("y = y + x*(slant factor)"), "factor", &wr, this),
+ center(_("Center"), _("The x-coord of this point is around which the slant will happen"), "center", &wr, this)
+{
+ registerParameter( dynamic_cast<Parameter *>(&factor) );
+ registerParameter( dynamic_cast<Parameter *>(¢er) );
+}
+
+LPESlant::~LPESlant()
+{
+}
+
+void
+LPESlant::doEffect(SPCurve * curve)
+{
+ NArtBpath *bpath = curve->_bpath;
+ int i = 0;
+ while(bpath[i].code != NR_END) {
+ bpath[i].y1 += (bpath[i].x1-center[Geom::X]) * factor;
+ bpath[i].y2 += (bpath[i].x2-center[Geom::X]) * factor;
+ bpath[i].y3 += (bpath[i].x3-center[Geom::X]) * factor;
+ i++;
+ }
+
+}
+
+}; //namespace LivePathEffect
+}; /* namespace Inkscape */
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|
