-
Bug
-
Resolution: Fixed
-
P4
-
1.2.2
-
1.2.2
-
generic
-
generic
The specs say that getBounds() returns a Rectangle object which represents the
bounding box of the Shape. getBounds2D() on the other hand returns a
Rectangle2D object which represents the high-precision bounding box of the Arc.
However, for the same Arc, the values returned by the two methods are very
different.
import java.awt.geom.Arc2D;
import java.awt.geom.Rectangle2D;
import java.awt.Rectangle;
public class Test {
public Test() {
String msg = "Arc2D.Float.getBounds2D(): ";
try {
Arc2D.Float arc = new Arc2D.Float(10,15,25,40,44,100,Arc2D.OPEN);
System.out.println(arc+".getBounds() returns "+arc.getBounds());
System.out.println();
System.out.println(arc+".getBounds2D() returns "+arc.getBounds2D());
} catch (Throwable ee) {
System.out.println(msg+": got Exception "+ee);
}
}
public static void main(String args[]) {
new Test();
}
}
Although the Shape interface documents that the Bounds2D is likely
to be tighter, the doc needs to be specific about the difference
between the values returned by getBounds() and getBounds2D().
bounding box of the Shape. getBounds2D() on the other hand returns a
Rectangle2D object which represents the high-precision bounding box of the Arc.
However, for the same Arc, the values returned by the two methods are very
different.
import java.awt.geom.Arc2D;
import java.awt.geom.Rectangle2D;
import java.awt.Rectangle;
public class Test {
public Test() {
String msg = "Arc2D.Float.getBounds2D(): ";
try {
Arc2D.Float arc = new Arc2D.Float(10,15,25,40,44,100,Arc2D.OPEN);
System.out.println(arc+".getBounds() returns "+arc.getBounds());
System.out.println();
System.out.println(arc+".getBounds2D() returns "+arc.getBounds2D());
} catch (Throwable ee) {
System.out.println(msg+": got Exception "+ee);
}
}
public static void main(String args[]) {
new Test();
}
}
Although the Shape interface documents that the Bounds2D is likely
to be tighter, the doc needs to be specific about the difference
between the values returned by getBounds() and getBounds2D().