-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.2.2
-
generic
-
generic
Name: rlT66838 Date: 09/09/99
The awt.geom.GeneralPath class stores coordinates internally as
floats rather than doubles. Since drawing with Strokes uses
the GeneralPath class as an intermediary, it becomes quite easy
to suffer catastropic loss of precision unless one works directly
in device coordinates (supposedly unnecessary with the 2D api!)
As an example, consider the code
public void render(Graphics2D g, double offset) {
Line2D l = new Line2D.Double (off, off, off+1.0, off+1.0);
g.setStroke(new BasicStroke(1f));
g.translate(-off, -off);
g.scale(100.0, 100.0);
g.draw(l);
}
which works correctly only if render is called with offset less
than about 1e+7 in absolute value. This kind of example occurs
naturally in geographic mapping applications.
Note further that all the other classes in awt.geom have 2
variants, float and double. GeneralPath should too.
(Review ID: 94214)
======================================================================
- duplicates
-
JDK-4172661 GeneralPath needs double version
-
- Resolved
-