Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SVGGraphics2D doesn't clip shapes because it attempts to use a PathIterator twice #33

Open
benediktmu opened this issue Jun 12, 2015 · 0 comments

Comments

@benediktmu
Copy link

SVGGraphics2D.draw(Shape) and SVGGraphics2D.fill(Shape) provide a PathIterator to the function writePathIterator(PathIterator, Properties). In writePathIterator, the PathIterator is first used to draw the shape via result.append(getPath(pi)); . However, when clipping is enabled, the PathIterator is used a second time by appending it to a GeneralPath: gp.append(pi, true);

This second use of the PathIterator doesn't work, because the first use has already used up the iterator. The result is that clipping is skipped because the clip doesn't seem to intersect the (seemingly empty) shape.

Suggestion: Change the function writePathIterator, so that it receives the Shape instead of a PathIterator (new name writeShape(Shape, Properties) ?). Then the two required PathIterators can be acquired in the function when needed.

benediktmu added a commit to benediktmu/freehep-vectorgraphics that referenced this issue Mar 21, 2016
Repaired SVG clipping: Non-working PathIterator reuse is replaced by
creating two PathIterators from a shape.
@benediktmu benediktmu mentioned this issue Mar 21, 2016
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant