LPE internals - conversions
Hello all,
Currently, LPEs have a 'doEffect' chain: basically a stack of functions that are called sequentially that convert from Inkscape's path type, to several 2geom types in steps. An LPE defines a doEffect within this chain to override the default behavior (pass on to next down the stack). The problem is this: Inkscape's paths can be discontinuous, meaning for the user that visually they are 2 separate paths. The LPE doeffect chain now converts it to one path. This means that for example lpe-PatternAlongPath will see discontinuous paths as a single path (thanks JFB!), so when applying a pattern (copy modus: single stretched) the pattern is applied along the whole path, ignoring the discontinuity. 1. Take two separate paths and combine them into one (ctrl+k) 2. draw a circle, convert to path, copy it 3. apply lpe-Pattern Along Path to (1) and paste the circle as pattern 4. the result will be two circle halves. where actually I would have expected to see two circles, since it looks like the original path is 2 paths.
This is undesired behavior I think. Note that e.g. lpe-Gear also suffers from this: it just seems to ignore the second path.
Do people consider this as a bug, or as a feature? The solution is to break the path into separate parts, group it, and apply an LPE on the group... but... especially with the lpe stacking, this is no longer possible and we do need to consider what lpe should do with discontinuous paths. I have made a fix, which I will probably apply to the whole doEffect chain. But perhaps people do not see this as a bug in PatternAlongPath, which means I will have to add a checkbox for the new behavior.... Basically, instead of concatinating all paths, run the effect multiple times on the differnt paths:
Technical, instead of:
std::vector<Path> doEffect_path (std::vector<Path> & path_in) { Piecewise<D2<SBasis> > pwd2_in; for (unsigned int i=0; i < path_in.size(); i++) { pwd2_in.concat( path_in[i].toPwSb() ); } Piecewise<Geom::D2Geom::SBasis > pwd2_out = doEffect_pwd2(pwd2_in); std::vector<Path> path_out = path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); return path_out; }
I want to change it to:
std::vector<Path> doEffect_path (std::vector<Path> & path_in) { std::vector<Path> path_out; for (unsigned int i=0; i < path_in.size(); i++) { Piecewise<Geom::D2Geom::SBasis > pwd2_in = path_in[i].toPwSb(); Piecewise<Geom::D2Geom::SBasis > pwd2_out = doEffect_pwd2(pwd2_in); std::vector<Path> path = path_from_piecewise( pwd2_out, LPE_CONVERSION_TOLERANCE); for (unsigned int j=0; j < path.size(); j++) { path_out.push_back(path[j]); } } return path_out; }
Note that: Piecewise<D2<SBasis> > doEffect_pwd2 (Piecewise<D2<SBasis> > & pwd2_in) ==> this one does the actual effect
Thanks for your consideration. I'll make sure this will not break the other effects.
Regards, Johan
On Tue, Apr 8, 2008 at 4:32 PM, <J.B.C.Engelen@...1578...> wrote:
- Take two separate paths and combine them into one (ctrl+k)
- draw a circle, convert to path, copy it
- apply lpe-Pattern Along Path to (1) and paste the circle as pattern
- the result will be two circle halves. where actually I would have expected to see two circles, since it looks like the original path is 2 paths.
This is undesired behavior I think. Note that e.g. lpe-Gear also suffers from this: it just seems to ignore the second path.
Do people consider this as a bug, or as a feature?
It is indeed a bug, and I reported it, and it was fixed in svn. So in revision 18266 this produces two visible separate circular brushes on two subpaths. Which version you're testing?
-----Original Message----- From: bulia byak [mailto:buliabyak@...400...] Sent: dinsdag 8 april 2008 22:11 To: Engelen, J.B.C. (Johan) Cc: inkscape-devel@lists.sourceforge.net; jf.barraud@...400...; steren.giannini@...400...; Bastien.Bouclet@...1940...; Anhalter42@...173... Subject: Re: LPE internals - conversions
On Tue, Apr 8, 2008 at 4:32 PM, <J.B.C.Engelen@...1578...> wrote:
- Take two separate paths and combine them into one (ctrl+k) 2.
draw a circle, convert to path, copy it 3. apply lpe-Pattern Along Path to (1) and paste the circle as pattern 4. the result
will be two
circle halves. where actually I would have expected to see
two circles, since it looks like the original path is 2 paths.
This is undesired behavior I think. Note that e.g.
lpe-Gear also suffers from this: it just seems to ignore the second path.
Do people consider this as a bug, or as a feature?
It is indeed a bug, and I reported it, and it was fixed in svn. So in revision 18266 this produces two visible separate circular brushes on two subpaths. Which version you're testing?
doh! I just tested and you are right. I remembered it from some time ago and went to fix it without testing whether the bug was still present. Thanks JFB for fixing it, but I am going to fix it another way! ;)
OK, so then I'll just go ahead and change the way the doEffect chain works. I'll check the other effects first, but at least it should fix the gear lpe.
Thanks, Johan
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of J.B.C.Engelen@...1578... Sent: dinsdag 8 april 2008 22:19 To: buliabyak@...400... Cc: inkscape-devel@lists.sourceforge.net; Bastien.Bouclet@...1940... Subject: Re: [Inkscape-devel] LPE internals - conversions
-----Original Message----- From: bulia byak [mailto:buliabyak@...400...] Sent: dinsdag 8 april 2008 22:11 To: Engelen, J.B.C. (Johan) Cc: inkscape-devel@lists.sourceforge.net; jf.barraud@...400...; steren.giannini@...400...; Bastien.Bouclet@...1940...; Anhalter42@...173... Subject: Re: LPE internals - conversions
On Tue, Apr 8, 2008 at 4:32 PM,
<J.B.C.Engelen@...1578...> wrote:
- Take two separate paths and combine them into one
(ctrl+k) 2.
draw a circle, convert to path, copy it 3. apply
lpe-Pattern Along
Path to (1) and paste the circle as pattern 4. the result
will be two
circle halves. where actually I would have expected to see
two circles, since it looks like the original path is 2 paths.
This is undesired behavior I think. Note that e.g.
lpe-Gear also suffers from this: it just seems to ignore the second path.
Do people consider this as a bug, or as a feature?
It is indeed a bug, and I reported it, and it was fixed in
svn. So in
revision 18266 this produces two visible separate circular
brushes on
two subpaths. Which version you're testing?
doh! I just tested and you are right. I remembered it from some time ago and went to fix it without testing whether the bug was still present. Thanks JFB for fixing it, but I am going to fix it another way! ;)
OK, so then I'll just go ahead and change the way the doEffect chain works. I'll check the other effects first, but at least it should fix the gear lpe.
I have changed the way the doEffect chain works. For old behavior put this in the constructor: concatenate_before_pwd2 = true; (which is done in lpe-bendpath.cpp for example)
Read a bit more details about it here: http://wiki.inkscape.org/wiki/index.php/MakingLivePathEffects#Write_your_eff... Or just study Effect::doEffect_path.
Regards, Johan
participants (2)
-
unknown@example.com
-
bulia byak