[OpenJDK 2D-Dev] clip with negative width or height in Graphics2D

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Dec 12 15:32:54 UTC 2012


Hello 2d team,
I have a question about clipping in our implementation of SunGraphics2D.
Currently if I set usrClip to Rectangle(100,100,-100,-100) the real clip 
will be clipRegion = 100,100,100,100;
But if I set clip to Rectangle2D with the same coordinates the real clip 
will be clipRegion = 0,0,100,100;(This is because we normalizes usrClip 
before use).
We automatically convert usrClip from Rectangle to Rectangle2D, if our 
graphics is scaled. So we get different clipRegion depending from scale.
What behavior is correct? Should we always normalize usrClip before use 
or should we treat it as empty/nonexistent rectangle?

-- 
Best regards, Sergey.




More information about the 2d-dev mailing list