lpe-perspective-envelope.cpp revision 018703fb53df7fb04966ad35e088201b1b630209
/** \file
* LPE <perspective-envelope> 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-perspective-envelope.h"
#include <gsl/gsl_linalg.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_PERSPECTIVE),
Up_Left_Point(_("Top Left"), _("Top Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Up_Left_Point", &wr, this),
Up_Right_Point(_("Top Right"), _("Top Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Up_Right_Point", &wr, this),
Down_Left_Point(_("Down Left"), _("Down Left - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "Down_Left_Point", &wr, this),
Down_Right_Point(_("Down Right"), _("Down Right - <b>Ctrl+Alt+Click</b>: reset, <b>Ctrl</b>: move along axes"), "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
path_it->back_closed();
}
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
while (curve_it1 != curve_endit) {
if (cubic) {
} else {
}
if(deform_type == DEFORMATION_PERSPECTIVE){
}else{
}
++curve_it1;
if(curve_it2 != curve_endit) {
++curve_it2;
}
}
//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) {
}else{
}
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}else{
if (widg) {
if (tip) {
} else {
widg->set_has_tooltip(false);
}
}
}
}
++it;
}
}
void
{
setDefaults();
}
void
{
}
void
{
}
void
{
setDefaults();
resetGrid();
}
void
LPEPerspectiveEnvelope::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: file_type=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :