summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-perspective_path.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects/lpe-perspective_path.cpp')
-rw-r--r--src/live_effects/lpe-perspective_path.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index 8097de783..901519b4f 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -23,7 +23,7 @@
#include "knot-holder-entity.h"
#include "knotholder.h"
#include "desktop.h"
-
+#include <util/units.h>
#include "inkscape.h"
#include <2geom/path.h>
@@ -44,6 +44,8 @@ public:
} // namespace PP
static Glib::ustring perspectiveID = _("First perspective");
+
+
LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
// initialise your parameters here:
@@ -62,36 +64,42 @@ LPEPerspectivePath::LPEPerspectivePath(LivePathEffectObject *lpeobject) :
concatenate_before_pwd2 = true; // don't split the path into its subpaths
_provides_knotholder_entities = true;
+}
- unapply = false;
- Persp3D *persp = persp3d_document_first_persp(lpeobject->document);
+LPEPerspectivePath::~LPEPerspectivePath()
+{
+
+}
+void
+LPEPerspectivePath::doOnApply(SPLPEItem const* lpeitem)
+{
+ Persp3D *persp = persp3d_document_first_persp(lpeitem->document);
if(persp == 0 ){
char *msg = _("You need a BOX 3D object");
Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO,
Gtk::BUTTONS_OK, true);
dialog.run();
- unapply = true;
- return;
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->removeCurrentPathEffect(false);
}
- Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat;
- pmat = pmat * SP_ACTIVE_DESKTOP->doc2dt();
- pmat.copy_tmat(tmat);
}
-
-LPEPerspectivePath::~LPEPerspectivePath()
-{
-
-}
-
void
LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem, true);
- if(unapply){
- SP_LPE_ITEM(lpeitem)->removeCurrentPathEffect(false);
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ Persp3D *persp = persp3d_document_first_persp(lpeitem->document);
+ if(persp == 0 ){
+ char *msg = _("You need a BOX 3D object");
+ Gtk::MessageDialog dialog(msg, false, Gtk::MESSAGE_INFO,
+ Gtk::BUTTONS_OK, true);
+ dialog.run();
return;
}
- SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ Proj::TransfMat3x4 pmat = persp->perspective_impl->tmat;
+ Geom::Affine doc2d = Geom::Scale(1, -1) * Geom::Translate(0, item->document->getHeight().value("px"));
+ pmat = pmat * doc2d;
+ pmat.copy_tmat(tmat);
item->apply_to_clippath(item);
item->apply_to_mask(item);
}