|<< Back to previous view|
[SWINGX-1478] PinstripePainter - incorrect intersection of the graphics clip area Created: 11/Jan/12 Updated: 14/Nov/12 Resolved: 14/Nov/12
|Remaining Estimate:||6 hours|
|Time Spent:||Not Specified|
|Original Estimate:||6 hours|
Windows XP, Java 1.6 r17, SwingX 1.6.2
|Participants:||Karl Schaefer and Protuhj|
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).
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).
|Comment by Karl Schaefer [ 14/Nov/12 08:07 PM ]|
Committed revision 4259.