lpe-perspective_path.cpp revision 0563fd55cbad59e8a878e6d4cbbdd8e47f74488d
/** \file
* LPE <perspective_path> implementation, used as an example for a base starting class
* when implementing new LivePathEffects.
*
* In vi, three global search-and-replaces will let you rename everything
* in this and the .h file:
*
* :%s/PERSPECTIVE_PATH/YOURNAME/g
* :%s/PerspectivePath/Yourname/g
* :%s/perspective_path/yourname/g
*/
/*
* Authors:
* Johan Engelen
* Maximilian Albert
*
* Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
* Copyright (C) Maximilian Albert 2008 <maximilian.albert@gmail.com>
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "persp3d.h"
//#include "transf_mat_3x4.h"
#include "document.h"
#include "live_effects/lpe-perspective_path.h"
#include "sp-item-group.h"
#include "inkscape.h"
// You might need to include other 2geom files. You can add them here:
namespace Inkscape {
namespace LivePathEffect {
// initialise your parameters here:
uses_plane_xy(_("Uses XY plane?"), _("If true, put the path on the left side of an imaginary box, otherwise on the right side"), "uses_plane_xy", &wr, this, true)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
concatenate_before_pwd2 = true; // don't split the path into its subpaths
}
{
}
void
{
original_bbox(lpeitem, true);
}
{
using namespace Geom;
// FIXME: the minus sign is there because the SVG coordinate system goes down;
// remove this once we have unified coordinate systems
boundingbox_Y.middle());
//Geom::Point orig = Geom::Point(bounds_X.min(), bounds_Y.middle());
//orig = Geom::Point(orig[X], sp_document_height(inkscape_active_document()) - orig[Y]);
//double offset = uses_plane_xy ? boundingbox_X.extent() : 0.0;
/**
g_print ("Orig: (%8.2f, %8.2f)\n", orig[X], orig[Y]);
g_print ("B[1] - orig[1]: %8.2f\n", (B[1] - orig[1])[0].valueAt(0));
g_print ("B[0] - orig[0]: %8.2f\n", (B[0] - orig[0])[0].valueAt(0));
**/
if (uses_plane_xy) {
} else {
preimage[0] = B[0] - B[0]; // hack!
}
/* set perspective origin to first point of path */
/**
g_print ("preimage[1]: %8.2f\n", preimage[1][0].valueAt(0));
g_print ("preimage[2]: %8.2f\n", preimage[2][0].valueAt(0));
**/
for (int j = 0; j < 3; ++j) {
res[j] =
+ tmat[j][3];
}
return output;
}
/* ######################## */
} //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 :