-
Bug
-
Resolution: Fixed
-
P4
-
7
-
b74
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2194403 | OpenJDK6 | Jennifer Godinez | P3 | Resolved | Fixed | b20 |
Bugzilla submission:
ThinLineTest: A line < 1 pixel disappears.
---------ThinLineTest.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 ThinLineTest {
private static final int PIXEL = 381;
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(0.5 / PIXEL, 0.5 / PIXEL);
g.setPaint(Color.BLACK);
g.setStroke(new BasicStroke(PIXEL));
g.draw(new Ellipse2D.Double(PIXEL * 50, PIXEL * 50, PIXEL * 300, PIXEL * 300));
// To visually check it
//ImageIO.write(image, "PNG", new File(args[0]));
boolean nonWhitePixelFound = false;
for (int x = 0; x < 200; ++x) {
if (image.getRGB(x, 100) != Color.WHITE.getRGB()) {
nonWhitePixelFound = true;
break;
}
}
if (!nonWhitePixelFound) {
throw new RuntimeException("The thin line disappeared.");
}
}
}
ThinLineTest: A line < 1 pixel disappears.
---------ThinLineTest.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 ThinLineTest {
private static final int PIXEL = 381;
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(0.5 / PIXEL, 0.5 / PIXEL);
g.setPaint(Color.BLACK);
g.setStroke(new BasicStroke(PIXEL));
g.draw(new Ellipse2D.Double(PIXEL * 50, PIXEL * 50, PIXEL * 300, PIXEL * 300));
// To visually check it
//ImageIO.write(image, "PNG", new File(args[0]));
boolean nonWhitePixelFound = false;
for (int x = 0; x < 200; ++x) {
if (image.getRGB(x, 100) != Color.WHITE.getRGB()) {
nonWhitePixelFound = true;
break;
}
}
if (!nonWhitePixelFound) {
throw new RuntimeException("The thin line disappeared.");
}
}
}
- backported by
-
JDK-2194403 ThinLineTest: A line < 1 pixel disappears.
- Resolved
- relates to
-
JDK-8311666 Disabled tests in test/jdk/sun/java2d/marlin
- Resolved