summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b802808)
raw | patch | inline | side by side (parent: b802808)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 14 Jun 2008 16:54:35 +0000 (16:54 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sat, 14 Jun 2008 16:54:35 +0000 (16:54 +0000) |
src/live_effects/lpe-spiro.cpp | patch | blob | history |
index e43efc01aedee1baee02174ef6ffa48496007bb0..6c3b71af483e0d54a35e4a1cc5b2053553551345 100644 (file)
#include "live_effects/bezctx_intf.h"
#include "live_effects/spiro.h"
+// For handling un-continuous paths:
+#include <2geom/pathvector.h>
+#include <2geom/matrix.h>
+#include "message-stack.h"
+#include "inkscape.h"
+#include "desktop.h"
+
typedef struct {
bezctx base;
SPCurve *curve;
void
LPESpiro::doEffect(SPCurve * curve)
{
+ Geom::PathVector original_pathv = curve->get_pathvector();
+
SPCurve *csrc = curve->copy();
curve->reset();
bezctx *bc = new_bezctx_ink(curve);
ib++;
}
g_free (path);
+
+ // FIXME: refactor the spiro code such that it cannot generate non-continous paths!
+ // sometimes, the code above generates a path that is not continuous. if so, undo the effect by resetting the original path.
+ try {
+ curve->get_pathvector() * Geom::identity(); // tests for continuity, this makes LPE Spiro slower of course :-(
+ }
+ catch (std::exception & e) {
+ g_warning("Exception during LPE Spiro execution. \n %s", e.what());
+ SP_ACTIVE_DESKTOP->messageStack()->flash( Inkscape::WARNING_MESSAGE,
+ _("An exception occurred during execution of the Spiro Path Effect.") );
+ curve->set_pathv(original_pathv);
+ }
}
}; //namespace LivePathEffect