lpe-slant.cpp revision 981b809bc6ed10a21e89444d9447e5475801874f
#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 *>(&center) );
}
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 :