United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6829659 Circle is rendered in C shape
JDK-6829659 : Circle is rendered in C shape

Details
Type:
Bug
Submit Date:
2009-04-13
Status:
Resolved
Updated Date:
2010-06-10
Project Name:
JDK
Resolved Date:
2009-06-30
Component:
client-libs
OS:
generic
Sub-Component:
2d
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports
Backport:

Sub Tasks

Description
Bugzilla patch submission:
ScaleTest: A circle is rendered in a 'C' shape.
--------------------ScaleTest.java---------------------
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;

/**
 * @author ###@###.### (Chris Nokleberg)
 * @author ###@###.### (Hiroshi Yamauchi)
 */
public class ScaleTest {
  public static void main(String[] args) throws Exception {
    BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = image.createGraphics();

    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setPaint(Color.WHITE);
    g.fill(new Rectangle(image.getWidth(), image.getHeight()));
    g.scale(.9, .9);
    g.setPaint(Color.BLACK);
    g.setStroke(new BasicStroke(0.5f));
    g.draw(new Ellipse2D.Double(25, 25, 150, 150));

    // To visually check it
    //ImageIO.write(image, "PNG", new File(args[0]));

    boolean nonWhitePixelFound = false;
    for (int x = 100; x < 200; ++x) {
      if (image.getRGB(x, 90) != Color.WHITE.getRGB()) {
        nonWhitePixelFound = true;
        break;
      }
    }
    if (!nonWhitePixelFound) {
      throw new RuntimeException("A circle is rendered like a 'C' shape.");
    }
  }
}

                                    

Comments
EVALUATION

See evaluation in the patch submitted by rkennke:
https://bugs.openjdk.java.net/show_bug.cgi?id=100030
                                     
2009-04-17
EVALUATION

New patch submitted by Hiroshi Yamauchi:
https://bugs.openjdk.java.net/show_bug.cgi?id=100030
                                     
2009-05-21



Hardware and Software, Engineered to Work Together