lpe-envelope-perspective.cpp revision 0b80160f17c943b213193c76334f707d902e2162
/** \file
* LPE <envelope-perspective> implementation
*/
/*
* Authors:
* Jabiertxof Code migration from python extensions envelope and perspective
* Aaron Spike, aaron@ekips.org from envelope and perspective phyton code
* Dmitry Platonov, shadowjack@mail.ru, 2006 perspective approach & math
* Jose Hevia (freon) Transform algorithm from envelope
*
* Copyright (C) 2007-2014 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gtkmm.h>
#include "live_effects/lpe-envelope-perspective.h"
#include <tools-switch.h>
#include <gsl/gsl_linalg.h>
#include "desktop.h"
using namespace Geom;
namespace Inkscape {
namespace LivePathEffect {
enum DeformationType {
};
};
static const Util::EnumDataConverter<unsigned> DeformationTypeConverter(DeformationTypeData, sizeof(DeformationTypeData)/sizeof(*DeformationTypeData));
// initialise your parameters here:
deform_type(_("Type"), _("Select the type of deformation"), "deform_type", DeformationTypeConverter, &wr, this, DEFORMATION_ENVELOPE),
Up_Right_Point(_("Top Right"), _("Top Right - Ctrl+Alt+Click to reset"), "Up_Right_Point", &wr, this),
Down_Left_Point(_("Down Left"), _("Down Left - Ctrl+Alt+Click to reset"), "Down_Left_Point", &wr, this),
Down_Right_Point(_("Down Right"), _("Down Right - Ctrl+Alt+Click to reset"), "Down_Right_Point", &wr, this)
{
// register all your parameters here, so Inkscape knows which parameters this effect has:
}
{
}
using Geom::X;
using Geom::Y;
if(deform_type == DEFORMATION_PERSPECTIVE){
handles[0] = Down_Left_Point;
double free_term[8] = {0};
double gslSolmatrix[64];
for(unsigned int i = 0; i < 4; ++i){
solmatrix[i][0] = sourceHandles[i][X];
}
int h = 0;
for( int i = 0; i < 8; i++ ) {
for( int j = 0; j < 8; j++ ) {
gslSolmatrix[h] = solmatrix[i][j];
h++;
}
}
//this is get by this page:
//http://www.gnu.org/software/gsl/manual/html_node/Linear-Algebra-Examples.html#Linear-Algebra-Examples
int s;
gsl_linalg_LU_decomp (&m.matrix, p, &s);
h = 0;
for( int i = 0; i < 3; i++ ) {
for( int j = 0; j < 3; j++ ) {
if(h==8){
continue;
}
projmatrix[i][j] = gsl_vector_get(x, h);
h++;
}
}
gsl_permutation_free (p);
gsl_vector_free (x);
}
for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
//Si está vacío...
continue;
//Itreadores
// if the path is closed, maybe we have to stop a bit earlier because the
// closing line segment has zerolength.
// Geom::LineSegment.
// closingline.isDegenerate() did not work, because it only checks for
// *exact* zero length, which goes wrong for relative coordinates and
// rounding errors...
// the closing line segment has zero-length. So stop before that one!
}
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
while (curve_it2 != curve_endit) {
if (cubic) {
} else {
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
++curve_it1;
++curve_it2;
}
if (cubic) {
} else {
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
//y cerramos la curva
}
delete nCurve;
}
}
vert->setPoints (pointAtRatio(yratio,Down_Left_Point,Up_Left_Point),pointAtRatio(yratio,Down_Right_Point,Up_Right_Point));
horiz->setPoints (pointAtRatio(xratio,Down_Left_Point,Down_Right_Point),pointAtRatio(xratio,Up_Left_Point,Up_Right_Point));
if(crossPoint){
}else{
return p;
}
}
}
return Point(x, y);
}
{
// use manage here, because after deletion of Effect object, others might still be pointing to this widget.
vbox->set_homogeneous(false);
if ((*it)->widget_is_visible) {
{
if (widg) {
#if WITH_GTKMM_3_0
hboxUpHandles->pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_EXPAND_WIDGET);
#else
#endif
#if WITH_GTKMM_3_0
hboxDownHandles->pack_start(*Gtk::manage(new Gtk::Separator(Gtk::ORIENTATION_VERTICAL)), Gtk::PACK_EXPAND_WIDGET);
#else
#endif
}else{
}
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}else{
if (widg) {
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}
}
++it;
}
#if WITH_GTKMM_3_0
#else
#endif
}
void
{
setDefaults();
}
void
{
}
void
{
//todo:this hack is only to reposition the knots on reser grid button
//Better update path effect in LPEITEM
}
void
{
setDefaults();
resetGrid();
}
void
LPEEnvelopePerspective::calculateCurve(Geom::Point a,Geom::Point b, SPCurve* c, bool horizontal, bool move)
{
using Geom::X;
using Geom::Y;
}
void
LPEEnvelopePerspective::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
{
c->reset();
c->moveto(Up_Left_Point);
c->lineto(Up_Right_Point);
c->lineto(Down_Right_Point);
c->lineto(Down_Left_Point);
c->lineto(Up_Left_Point);
}
/* ######################## */
} //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 :