summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/live_effects/lpe-bendpath.cpp3
-rw-r--r--src/live_effects/lpe-envelope-perspective.cpp3
-rw-r--r--src/live_effects/lpe-envelope.cpp5
-rw-r--r--src/live_effects/lpe-lattice.cpp3
-rw-r--r--src/live_effects/lpe-lattice2.cpp3
-rw-r--r--src/live_effects/lpe-mirror_symmetry.cpp8
-rw-r--r--src/live_effects/lpe-mirror_symmetry.h2
-rw-r--r--src/live_effects/lpe-offset.cpp8
-rw-r--r--src/live_effects/lpe-offset.h2
-rw-r--r--src/live_effects/lpe-perspective_path.cpp3
-rw-r--r--src/live_effects/lpe-roughen.cpp5
-rw-r--r--src/live_effects/lpe-roughen.h2
-rw-r--r--src/live_effects/lpe-simplify.cpp3
-rw-r--r--src/live_effects/lpe-vonkoch.cpp3
-rw-r--r--src/selection-chemistry.cpp4
-rw-r--r--src/sp-lpe-item.cpp97
-rw-r--r--src/sp-lpe-item.h6
17 files changed, 138 insertions, 22 deletions
diff --git a/src/live_effects/lpe-bendpath.cpp b/src/live_effects/lpe-bendpath.cpp
index eaf9fe4a6..33171b184 100644
--- a/src/live_effects/lpe-bendpath.cpp
+++ b/src/live_effects/lpe-bendpath.cpp
@@ -76,6 +76,9 @@ LPEBendPath::doBeforeEffect (SPLPEItem const* lpeitem)
{
// get the item bounding box
original_bbox(lpeitem);
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
Geom::Piecewise<Geom::D2<Geom::SBasis> >
diff --git a/src/live_effects/lpe-envelope-perspective.cpp b/src/live_effects/lpe-envelope-perspective.cpp
index 3b91eb183..f847dddc5 100644
--- a/src/live_effects/lpe-envelope-perspective.cpp
+++ b/src/live_effects/lpe-envelope-perspective.cpp
@@ -350,6 +350,9 @@ LPEEnvelopePerspective::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
setDefaults();
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
void
diff --git a/src/live_effects/lpe-envelope.cpp b/src/live_effects/lpe-envelope.cpp
index 4f5623fba..05a672ae8 100644
--- a/src/live_effects/lpe-envelope.cpp
+++ b/src/live_effects/lpe-envelope.cpp
@@ -32,7 +32,7 @@ LPEEnvelope::LPEEnvelope(LivePathEffectObject *lpeobject) :
bend_path2(_("Right bend path:"), _("Right path along which to bend the original path"), "bendpath2", &wr, this, "M0,0 L1,0"),
bend_path3(_("Bottom bend path:"), _("Bottom path along which to bend the original path"), "bendpath3", &wr, this, "M0,0 L1,0"),
bend_path4(_("Left bend path:"), _("Left path along which to bend the original path"), "bendpath4", &wr, this, "M0,0 L1,0"),
- xx(_("E_nable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
+ xx(_("_Enable left & right paths"), _("Enable the left and right deformation paths"), "xx", &wr, this, true),
yy(_("_Enable top & bottom paths"), _("Enable the top and bottom deformation paths"), "yy", &wr, this, true)
{
registerParameter( dynamic_cast<Parameter *>(&yy) );
@@ -54,6 +54,9 @@ LPEEnvelope::doBeforeEffect (SPLPEItem const* lpeitem)
{
// get the item bounding box
original_bbox(lpeitem);
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
Geom::Piecewise<Geom::D2<Geom::SBasis> >
diff --git a/src/live_effects/lpe-lattice.cpp b/src/live_effects/lpe-lattice.cpp
index 8136569e8..a241a8a2e 100644
--- a/src/live_effects/lpe-lattice.cpp
+++ b/src/live_effects/lpe-lattice.cpp
@@ -176,6 +176,9 @@ void
LPELattice::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
void
diff --git a/src/live_effects/lpe-lattice2.cpp b/src/live_effects/lpe-lattice2.cpp
index db609c9e1..9dad78f6e 100644
--- a/src/live_effects/lpe-lattice2.cpp
+++ b/src/live_effects/lpe-lattice2.cpp
@@ -254,6 +254,9 @@ LPELattice2::doBeforeEffect (SPLPEItem const* lpeitem)
{
original_bbox(lpeitem);
setDefaults();
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
void
diff --git a/src/live_effects/lpe-mirror_symmetry.cpp b/src/live_effects/lpe-mirror_symmetry.cpp
index 4d4837d8d..0bb67a4a2 100644
--- a/src/live_effects/lpe-mirror_symmetry.cpp
+++ b/src/live_effects/lpe-mirror_symmetry.cpp
@@ -43,6 +43,14 @@ LPEMirrorSymmetry::~LPEMirrorSymmetry()
}
void
+LPEMirrorSymmetry::doBeforeEffect (SPLPEItem const* lpeitem)
+{
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
+}
+
+void
LPEMirrorSymmetry::doOnApply (SPLPEItem const* lpeitem)
{
using namespace Geom;
diff --git a/src/live_effects/lpe-mirror_symmetry.h b/src/live_effects/lpe-mirror_symmetry.h
index c01d1bf6f..a4a2b86c0 100644
--- a/src/live_effects/lpe-mirror_symmetry.h
+++ b/src/live_effects/lpe-mirror_symmetry.h
@@ -30,6 +30,8 @@ public:
virtual void doOnApply (SPLPEItem const* lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
+
virtual std::vector<Geom::Path> doEffect_path (std::vector<Geom::Path> const & path_in);
private:
diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp
index 192bd17ca..dc91775b7 100644
--- a/src/live_effects/lpe-offset.cpp
+++ b/src/live_effects/lpe-offset.cpp
@@ -55,6 +55,14 @@ static void append_half_circle(Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
pwd2.continuousConcat(cap_pwd2);
}
+void
+LPEOffset::doBeforeEffect (SPLPEItem const* lpeitem)
+{
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
+}
+
Geom::Piecewise<Geom::D2<Geom::SBasis> >
LPEOffset::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in)
{
diff --git a/src/live_effects/lpe-offset.h b/src/live_effects/lpe-offset.h
index 9966fd45d..997311c7d 100644
--- a/src/live_effects/lpe-offset.h
+++ b/src/live_effects/lpe-offset.h
@@ -28,6 +28,8 @@ public:
virtual void doOnApply (SPLPEItem const* lpeitem);
+ virtual void doBeforeEffect (SPLPEItem const* lpeitem);
+
virtual Geom::Piecewise<Geom::D2<Geom::SBasis> > doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
private:
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index 9e21f5d25..d43772cf7 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -90,6 +90,9 @@ LPEPerspectivePath::doBeforeEffect (SPLPEItem const* lpeitem)
SP_LPE_ITEM(lpeitem)->removeCurrentPathEffect(false);
return;
}
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
void LPEPerspectivePath::refresh(Gtk::Entry* perspective) {
diff --git a/src/live_effects/lpe-roughen.cpp b/src/live_effects/lpe-roughen.cpp
index b9d575e06..ffd5433bf 100644
--- a/src/live_effects/lpe-roughen.cpp
+++ b/src/live_effects/lpe-roughen.cpp
@@ -71,11 +71,14 @@ LPERoughen::LPERoughen(LivePathEffectObject *lpeobject)
LPERoughen::~LPERoughen() {}
-void LPERoughen::doBeforeEffect(SPLPEItem const */*lpeitem*/)
+void LPERoughen::doBeforeEffect(SPLPEItem const *lpeitem)
{
displaceX.resetRandomizer();
displaceY.resetRandomizer();
srand(1);
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
Gtk::Widget *LPERoughen::newWidget()
diff --git a/src/live_effects/lpe-roughen.h b/src/live_effects/lpe-roughen.h
index 7e99b47bf..d5ec726bd 100644
--- a/src/live_effects/lpe-roughen.h
+++ b/src/live_effects/lpe-roughen.h
@@ -38,7 +38,7 @@ public:
virtual void doEffect(SPCurve *curve);
virtual double sign(double randNumber);
virtual Geom::Point randomize();
- virtual void doBeforeEffect(SPLPEItem const */*lpeitem*/);
+ virtual void doBeforeEffect(SPLPEItem const * lpeitem);
virtual SPCurve *addNodesAndJitter(const Geom::Curve *A, double t);
virtual SPCurve *jitter(const Geom::Curve *A);
virtual Geom::Point tpoint(Geom::Point A, Geom::Point B, double t = 0.5);
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp
index a817f30f1..c191fbbe6 100644
--- a/src/live_effects/lpe-simplify.cpp
+++ b/src/live_effects/lpe-simplify.cpp
@@ -65,6 +65,9 @@ LPESimplify::doBeforeEffect (SPLPEItem const* lpeitem)
hp.clear();
}
bbox = SP_ITEM(lpeitem)->visualBounds();
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
diff --git a/src/live_effects/lpe-vonkoch.cpp b/src/live_effects/lpe-vonkoch.cpp
index 8b0b716fe..7c1913076 100644
--- a/src/live_effects/lpe-vonkoch.cpp
+++ b/src/live_effects/lpe-vonkoch.cpp
@@ -264,6 +264,9 @@ LPEVonKoch::doBeforeEffect (SPLPEItem const* lpeitem)
tmp_pathv.push_back(tmp_path);
ref_path.set_new_value(tmp_pathv,true);
}
+ SPLPEItem * item = const_cast<SPLPEItem*>(lpeitem);
+ item->apply_to_clippath(item);
+ item->apply_to_mask(item);
}
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 7c614a581..956e1719c 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -4063,6 +4063,10 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
for ( SPObject *child = obj->firstChild() ; child; child = child->getNext() ) {
// Collect all clipped paths and masks within a single group
Inkscape::XML::Node *copy = SP_OBJECT(child)->getRepr()->duplicate(xml_doc);
+ if(copy->attribute("inkscape:original-d"))
+ {
+ copy->setAttribute("d", copy->attribute("inkscape:original-d"));
+ }
items_to_move = g_slist_prepend(items_to_move, copy);
}
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp
index 8ca6e6490..f012d1df7 100644
--- a/src/sp-lpe-item.cpp
+++ b/src/sp-lpe-item.cpp
@@ -56,7 +56,6 @@ static void lpeobject_ref_modified(SPObject *href, guint flags, SPLPEItem *lpeit
static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem);
static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem);
-static void sp_lpe_item_apply_to_clip_or_mask_group(SPGroup * group, SPItem * item);
typedef std::list<std::string> HRefList;
static std::string patheffectlist_write_svg(PathEffectList const & list);
@@ -344,6 +343,16 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem)
{
g_return_if_fail(lpeitem != NULL);
+ SPMask * mask = lpeitem->mask_ref->getObject();
+ if(mask)
+ {
+ sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(mask->firstChild()));
+ }
+ SPClipPath * clipPath = lpeitem->clip_ref->getObject();
+ if(clipPath)
+ {
+ sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild()));
+ }
if (SP_IS_GROUP(lpeitem)) {
GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem));
for ( GSList const *iter = item_list; iter; iter = iter->next ) {
@@ -367,6 +376,18 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem)
g_return_if_fail(lpeitem != NULL);
if (SP_IS_GROUP(lpeitem)) {
+ if (!lpeitem->hasPathEffectRecursive()) {
+ SPMask * mask = lpeitem->mask_ref->getObject();
+ if(mask)
+ {
+ sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild()));
+ }
+ SPClipPath * clipPath = lpeitem->clip_ref->getObject();
+ if(clipPath)
+ {
+ sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild()));
+ }
+ }
GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem));
for ( GSList const *iter = item_list; iter; iter = iter->next ) {
SPObject *subitem = static_cast<SPObject *>(iter->data);
@@ -378,6 +399,16 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem)
else if (SP_IS_PATH(lpeitem)) {
Inkscape::XML::Node *repr = lpeitem->getRepr();
if (!lpeitem->hasPathEffectRecursive() && repr->attribute("inkscape:original-d")) {
+ SPMask * mask = lpeitem->mask_ref->getObject();
+ if(mask)
+ {
+ sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild()));
+ }
+ SPClipPath * clipPath = lpeitem->clip_ref->getObject();
+ if(clipPath)
+ {
+ sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clipPath->firstChild()));
+ }
repr->setAttribute("d", repr->attribute("inkscape:original-d"));
repr->setAttribute("inkscape:original-d", NULL);
}
@@ -613,12 +644,8 @@ bool SPLPEItem::hasPathEffectRecursive() const
return hasPathEffect();
}
}
-
-//The next 3 functions are because the revert of the bug 1241902
-//for the moment not used
-
void
-sp_lpe_item_apply_to_clippath(SPItem * item)
+SPLPEItem::apply_to_clippath(SPItem *item)
{
SPClipPath *clipPath = item->clip_ref->getObject();
if(clipPath) {
@@ -630,11 +657,18 @@ sp_lpe_item_apply_to_clippath(SPItem * item)
} else if(SP_IS_SHAPE(clip_data)) {
clip_curve = SP_SHAPE(clip_data)->getCurve();
} else if(SP_IS_GROUP(clip_data)) {
- sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(clip_data), item);
+ apply_to_clip_or_mask_group(SP_ITEM(clip_data), item);
return;
}
if(clip_curve) {
- bool success = SP_LPE_ITEM(item)->performPathEffect(clip_curve);
+ bool success = false;
+ if(SP_IS_GROUP(this)){
+ clip_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)));
+ success = this->performPathEffect(clip_curve);
+ clip_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse());
+ } else {
+ success = this->performPathEffect(clip_curve);
+ }
Inkscape::XML::Node *reprClip = clip_data->getRepr();
if (success) {
gchar *str = sp_svg_write_path(clip_curve->get_pathvector());
@@ -654,10 +688,17 @@ sp_lpe_item_apply_to_clippath(SPItem * item)
clip_curve->unref();
}
}
+ if(SP_IS_GROUP(item)){
+ GSList const *item_list = sp_item_group_item_list(SP_GROUP(item));
+ for ( GSList const *iter = item_list; iter; iter = iter->next ) {
+ SPObject *subitem = static_cast<SPObject *>(iter->data);
+ apply_to_clippath(SP_ITEM(subitem));
+ }
+ }
}
void
-sp_lpe_item_apply_to_mask(SPItem * item)
+SPLPEItem::apply_to_mask(SPItem *item)
{
SPMask *mask = item->mask_ref->getObject();
if(mask) {
@@ -669,11 +710,18 @@ sp_lpe_item_apply_to_mask(SPItem * item)
} else if(SP_IS_SHAPE(mask_data)) {
mask_curve = SP_SHAPE(mask_data)->getCurve();
} else if(SP_IS_GROUP(mask_data)) {
- sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(mask_data), item);
+ apply_to_clip_or_mask_group(SP_ITEM(mask_data), item);
return;
}
if(mask_curve) {
- bool success = SP_LPE_ITEM(item)->performPathEffect(mask_curve);
+ bool success = false;
+ if(SP_IS_GROUP(this)){
+ mask_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)));
+ success = this->performPathEffect(mask_curve);
+ mask_curve->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse());
+ } else {
+ success = this->performPathEffect(mask_curve);
+ }
Inkscape::XML::Node *reprmask = mask_data->getRepr();
if (success) {
gchar *str = sp_svg_write_path(mask_curve->get_pathvector());
@@ -693,16 +741,26 @@ sp_lpe_item_apply_to_mask(SPItem * item)
mask_curve->unref();
}
}
+ if(SP_IS_GROUP(item)){
+ GSList const *item_list = sp_item_group_item_list(SP_GROUP(item));
+ for ( GSList const *iter = item_list; iter; iter = iter->next ) {
+ SPObject *subitem = static_cast<SPObject *>(iter->data);
+ apply_to_mask(SP_ITEM(subitem));
+ }
+ }
}
-static void
-sp_lpe_item_apply_to_clip_or_mask_group(SPGroup *group, SPItem *item)
+void
+SPLPEItem::apply_to_clip_or_mask_group(SPItem *group, SPItem *item)
{
- GSList *item_list = sp_item_group_item_list(group);
+ if (!SP_IS_GROUP(group)) {
+ return;
+ }
+ GSList *item_list = sp_item_group_item_list(SP_GROUP(group));
for ( GSList *iter = item_list; iter; iter = iter->next ) {
SPObject *subitem = static_cast<SPObject *>(iter->data);
if (SP_IS_GROUP(subitem)) {
- sp_lpe_item_apply_to_clip_or_mask_group(SP_GROUP(subitem), item);
+ apply_to_clip_or_mask_group(SP_ITEM(subitem), item);
} else if (SP_IS_SHAPE(subitem)) {
SPCurve * c = NULL;
@@ -712,7 +770,14 @@ sp_lpe_item_apply_to_clip_or_mask_group(SPGroup *group, SPItem *item)
c = SP_SHAPE(subitem)->getCurve();
}
if (c) {
- bool success = SP_LPE_ITEM(item)->performPathEffect(c);
+ bool success = false;
+ if(SP_IS_GROUP(group)){
+ c->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)));
+ success = this->performPathEffect(c);
+ c->transform(i2anc_affine(SP_GROUP(item), SP_GROUP(this)).inverse());
+ } else {
+ success = this->performPathEffect(c);
+ }
Inkscape::XML::Node *repr = subitem->getRepr();
if (success) {
gchar *str = sp_svg_write_path(c->get_pathvector());
diff --git a/src/sp-lpe-item.h b/src/sp-lpe-item.h
index fbac467fd..9c052b7b1 100644
--- a/src/sp-lpe-item.h
+++ b/src/sp-lpe-item.h
@@ -90,14 +90,14 @@ public:
void removeAllPathEffects(bool keep_paths);
void addPathEffect(char *value, bool reset);
void addPathEffect(LivePathEffectObject * new_lpeobj);
-
+ void apply_to_mask(SPItem * item);
+ void apply_to_clippath(SPItem * item);
+ void apply_to_clip_or_mask_group(SPItem * group, SPItem * item);
bool forkPathEffectsIfNecessary(unsigned int nr_of_allowed_users = 1);
void editNextParamOncanvas(SPDesktop *dt);
};
-void sp_lpe_item_apply_to_mask(SPItem * item);
-void sp_lpe_item_apply_to_clippath(SPItem * item);
void sp_lpe_item_update_patheffect (SPLPEItem *lpeitem, bool wholetree, bool write); // careful, class already has method with *very* similar name!
#endif /* !SP_LPE_ITEM_H_SEEN */