-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
None
-
generic
-
solaris
Name: auR10023 Date: 03/12/2004
Two segments (one is a subsegment of the other) should set up the same points
with the same values at their overlapping parts.
But this works only on windows platform. On solaris and linux in some
cases we have a lot of different points.
Note, this happens only when antialiasing is turned on otherwise we have
the same result on all platforms.
Following test illustrates the problem.
It draws segments described above in separate BufferedImages then
compares them in (10,10,990,990) area. The difference (if any) is shown
by putting images together with XOR enabled.
-----------------------------Test.java------------------------------------
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
public class Test {
public static final int SIZE = 1000;
public static BufferedImage bi3;
public static void main(String[] args) {
BufferedImage bi1 = new BufferedImage(SIZE, SIZE,
BufferedImage.TYPE_INT_RGB);
BufferedImage bi2 = new BufferedImage(SIZE, SIZE,
BufferedImage.TYPE_INT_RGB);
bi3 = new BufferedImage(SIZE, SIZE, BufferedImage.TYPE_INT_RGB);
Graphics2D g1 = bi1.createGraphics();
Graphics2D g2 = bi2.createGraphics();
g1.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g1.setColor(Color.white);
g1.fillRect(0, 0, SIZE, SIZE);
g2.setColor(Color.white);
g2.fillRect(0, 0, SIZE, SIZE);
int x1 = 200;
int y1 = 400;
int dx = 1000;
int dy = 800;
g1.setColor(Color.black);
g1.drawLine(x1, y1, x1 + dx, y1 + dy);
g2.setColor(Color.black);
g2.drawLine(x1, y1, x1 + 500*dx, y1 + 500*dy);
int counter = 0;
for (int i = 10; i < SIZE - 10 ; i++) {
for (int j = 10; j < SIZE -10 ; j++) {
if ( bi1.getRGB(i,j) != bi2.getRGB(i,j)) {
counter++;
}
}
}
Graphics2D gr = bi3.createGraphics();
gr.setXORMode(Color.white);
gr.drawImage(bi1, 0, 0, null);
gr.drawImage(bi2, 0, 0, null);
if (counter > 0) {
Frame frame = new Frame() {
public void paint(Graphics g) {
Graphics2D gr = (Graphics2D)g;
gr.drawImage(bi3, 10, 10, null);
}
};
frame.setSize(1010, 1010);
frame.setVisible(true);
}
System.out.println("Differs at " + counter + " points");
}
}
--------------------------------------------------------------------------
Solaris:
#java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b41)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b41, mixed mode)
java Test
Differs at 279 points
windows 2000:
#java.exe -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b41)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b41, mixed mode)
#java.exe Test
Differs at 0 points
======================================================================