I understand that this may have only been tested on Swing components, but I would expect it to work on any Graphics context without modification. I am working on an application to draw a simplified map with very large coordinates, and very large shapes. I wanted to use the PinstripePainter to draw a large (non-rectangular) shape with a pinstriped interior, so I set the clip to the desired shape on the graphics context before invoking the PinstripePainter, the clip is not located at (0,0).
See This post for the original discussion.
In PinstripePainter.java#doPaint(...), the code attempts to intersect the area object with a rectangle at (x,y) (0,0).
If you have a clip set that is not at (0,0), the Areas don't intersect, obviously, and nothing gets painted.
I am trying to set a clip of an Ellipse2D.Double object that is nowhere near the center of the graphics context, and after intersect() gets called, the area object contains no curves (no intersection).
If I evaluate this code in my IDE via a breakpoint, the proper intersection is created:
So, if a clip exists, the Rectangle used to check for intersection needs to use the clip's bounding rectangle coordinates.
Also, the code doesn't work for very large shapes (where ((width * width) + (height + height)) would overflow an int).
Cast to a double to get it to work for large shapes in the Math.sqrt(...) call.
To test your fix, I would just use a Canvas to draw a large Ellipse2D.Double (20000 width, 75000 height) not located at (0,0).