-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.1
-
generic
-
generic
Name: dbT83986 Date: 04/17/99
When using drawLine(x,y,x,y) in XOR mode in an off-screen image,
no pixel is changed. It should change pixel (x,y), just like
fillRect(x,y,1,1) does.
The program below prints
sun.awt.image.BufferedImageGraphics2D
Pixels drawn:
(2,5)
whereas with JDK 1.1.7 it prints
sun.awt.motif.X11Graphics
Pixels drawn:
(2,5)
(7,5)
import java.awt.*;
import java.awt.image.*;
public class DrawLineBug {
public static void main (String[] args) {
int width = 10;
int height = 10;
Frame auxWindow = new Frame();
auxWindow.addNotify();
Image image = auxWindow.createImage(width,height);
Graphics g = image.getGraphics();
System.out.println(g.getClass().getName());
g.setColor(Color.black);
g.drawLine(2,5,2,5);
g.setXORMode(Color.blue);
g.drawLine(7,5,7,5);
g.dispose();
int[] pixels = new int[width*height];
PixelGrabber pg = new PixelGrabber(image,0,0,width,height,pixels,0,width);
try {
pg.grabPixels();
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Pixels drawn:");
int background = pixels[0+0*width];
for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
if (pixels[x+y*width] != background)
System.out.println("("+x+","+y+")");
System.exit(0);
}
}
(Review ID: 57061)
======================================================================
- duplicates
-
JDK-4204551 XOR mode for shapes broken in swing components but not AWT
-
- Resolved
-