Skip to content

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

Open
@benediktmu

Description

@benediktmu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions