-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SVG backend doesn't fill loops if they occur in the same subtree as a line #141
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me a bit uneasy, though I'm willing to be convinced. Are we sure that a transparent fill is going to be the same as no fill for all backends, in all situations? This is also going to result in a bunch of extra SVG nodes specifying a transparent fill even when the user did not set any fill colors anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative I was thinking about was to add an
RTree -> RTree
pass during compilation which splits and removes fill attributes as appropriate. However, Jeff correctly points out that given the way we currently have things organized, this would mean that the compilation code indiagrams-core
would have to depend on attributes defined indiagrams-lib
. We would either have to move some attributes intodiagrams-core
(seems wrong), or move the compilation code intodiagrams-lib
--- which actually might be the right thing to do, I am not sure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming (perhaps incorrectly) that it's only SVG amongst our current
backends that fills open paths. I'm basing this on the fact the the others
all render the backend-tests correctly. If this is correct we only have to
worry about whether transparent fill == no fill for backends we do not yet
have, also it seems a shame to have to reorganize and add complexity to
our code. Unless of course this is the right thing to do irrespective of
this problem.
I think the extra SVG nodes could be removed in an optimization pass on the
RTree so I'm not too worried about this one, since we plan on optimizing
the RTree anyway.
Lastly, somehow I feel that having to add an RTree -> RTree pass for
reasons other than optimization, may signal a defect in design, my
intuition is that the issue should be handled earlier in the process. This
is just my own opinion - I have no formal way to back it up.
On Wed, Nov 27, 2013 at 2:42 PM, Brent Yorgey notifications@github.comwrote:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a compromise is to add a
NoColor
attribute value forFillColor
, something likeand use this instead of
transparent
. Then the SVG backend could handleNoColor
withfcA transparent
and other backends would do whatever they need to, which for existing backends is nothing. I would have to put some more thought into whether this would work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: assuming that only SVG fills open paths: that's true, but it's something of an implementation detail/accident. Reorganization of other backends might produce the same problem (in particular, postscript has not been ported to the backend tree stuff yet). And in any case, even so it's not true that we only have to worry about what transparent fill means for backends we don't yet have, since (1) we certainly have to worry about what it means for SVG, and (2) actually we have to worry about it for all backends, since if we are going to be adding transparent fill attributes in
diagrams-lib
then all backends are going to see and process them."I think the extra SVG nodes could be removed in an optimization pass on the RTree" -- but that would again require moving the compilation/optimization stuff into
diagrams-lib
.Re: adding
RTree
passes for reasons other than optimization, I don't feel the same as you. The point of theDTree
andRTree
stuff is not just to optimize, but more generally to do whatever centralized hard work we can in order to make life easier for backends. We take diagrams and produce simplerRTrees
with some invariant guarantees that backends can take advantage of in order to make their job easier. One such guarantee could be, for example, that fill color attributes have no lines in the subtree underneath them.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: adding
NoColor
, I thought of that, but I don't think it's a very good solution. If the SVG backend implements it byfcA transparent
then we still have to worry about whether this is the same as no fill (it seems like it should be, of course, but I still don't know this for certain); and if other backends can't do that, then they might have to do some whole-tree analysis to figure out what to do---exactly what we are trying to avoid.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm don't love either of the two proposed solutions so perhaps we should keep thinking about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. As I mentioned earlier, I think users are very unlikely to run into this often in practice (and it's very easy to work around if they do), so there's no particular rush to fix this. It's definitely worth sitting on it for a while until we have something we're all happy with.