-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
generic
-
generic
Name: dbT83986 Date: 03/21/99
The below code will produce the discrepency between the standard oval in the Graphics package and the Ellipse2D in the
Graphics2D package - the Ellipse2D object doesn't "look" quite right, and certianly not as good as the standard oval object.
The documenation seems to indicate the 2D objects will only look right when anti-aliasing is on unless some "rule" is applied
for selecting pixels during the rasterization process, but it doesn't say what this rule is or how to use it. If anti-aliasing is turned
on, one can't tell the difference between the oval and the Ellipse2D, but with it off, the Ellipse2D doesn't look as intended at all.
Code:
import java.awt.*;
public class inc55846 extends Frame
{
public inc55846()
{
add(new OvalCanvas());
setSize(100,100);
}
public static void main(String[] args)
{
new inc55846().show();
}
}
class OvalCanvas extends Canvas
{
public void paint(Graphics g)
{
Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.red);
g.drawOval(45, 10, 30, 30);
// Notice the difference between an Ellipse2D.Float and a simple Oval:
g2.setPaint(Color.red);
Ellipse2D.Float ellipse1 = new Ellipse2D.Float(10.0f, 10.0f, 30.0f, 30.0f);
g2.draw(ellipse1);
}
}
(Review ID: 55846)
======================================================================
- duplicates
-
JDK-4151279 Curves are not as pleasing as JDK 1.1 (affects ovals, arcs and roundrects)
-
- Resolved
-