[OpenJDK 2D-Dev] Shape.contains - returns true where it should not

Geronimo Ma. Hernandez geronimo013 at gmx.com
Mon Mar 19 15:32:14 UTC 2012


Hello,

I'm working on filling text to arbitrary shapes, where I hit the named problem.
It's not easy to reproduce, as it depends on fontsize and shape ...

So using the attached code reproduces the attached image.

I use the call Shape.contains(double x, double y, double w, double h) where 
the apidoc says: "Tests if the interior of the Shape entirely contains the 
specified rectangular area."

reaching the last line, there should be no match at all, as most of the given 
rectangle is outside the shape (for all succeeding tests).
To verify my understanding I draw the tested rectangle when the contains-
method returns true.

May be, my sample hits the insideness of a point (from Shape-apidocs), where 
the point lies on the shape boundary and the succeeding point is inside the 
shape.
That might be true for the base point of the rectangle, but it is never true, 
for the entire rectangle.

So this might be considered a bug.


kind regards

Gero
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Java2DFailure-3.png
Type: image/png
Size: 12808 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20120319/685904c2/Java2DFailure-3.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fillShapeWithText.java
Type: text/x-java
Size: 1715 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20120319/685904c2/fillShapeWithText.java>


More information about the 2d-dev mailing list