-
Bug
-
Resolution: Fixed
-
P2
-
jai_fcs-dev, 1.2.0
-
kestrel
-
x86
-
windows_nt
Images displayed on Windows in a JAI ScrollingImagePanel change colors on resize
On resizing the image color changes dramatically displaying incorrect colors
The ScrollingImagePanel uses a scrollPane and an ImageCanvas and their use is shown in the attachments and test case. The ScrollPane doesnt scroll anymore after resize and the display continues to hold wierd colors and shows patchy image if partially obscured by another window.
I have contacted engineer Jeannette Hung over this issue and She said the problem was that the clip state was not being validated in RasterOutputManager.renderImage(). I am not sure if this problem might also be with the way ScrollPane is implemented. Its is a serious bug (filed as P2 in our category) and needs to be fixed by our FCS.
Name: dsC76792 Date: 09/17/99
###@###.###
Here is a simplified test case that reproduces the same problem.
It's not so easy to make the color change by resizing, but it
clearly manifests when scrolling.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
public class DisplayTest extends Component {
public static final int WIDTH = 500;
public static final int HEIGHT = 500;
BufferedImage bufferedimage = new BufferedImage(WIDTH, HEIGHT,
BufferedImage.TYPE_3BYTE_BGR);
public DisplayTest() {
DataBuffer buffer = bufferedimage.getRaster().getDataBuffer();
for (int i = 2; i < buffer.getSize(); i+=3) {
buffer.setElem(i - 2, 255);
buffer.setElem(i - 1, 0);
buffer.setElem(i, 0);
}
}
public void paint(Graphics g) {
g.setClip(0, 0, WIDTH, HEIGHT);
g.drawImage(bufferedimage, 0, 0, this);
}
public Dimension getPreferredSize() {
return new Dimension(WIDTH, HEIGHT);
}
public static void main(String args[]) {
Frame frame = new Frame("Test");
ScrollPane scrollPane = new ScrollPane();
scrollPane.add(new DisplayTest());
frame.add(scrollPane);
frame.pack();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
}
}
The setClip() call in paint() matters. The exact clip rectangle isn't
important, but the left-top corner of the new clip should differ from
the left-top corner of the original clip for the bug to manifest.
======================================================================
On resizing the image color changes dramatically displaying incorrect colors
The ScrollingImagePanel uses a scrollPane and an ImageCanvas and their use is shown in the attachments and test case. The ScrollPane doesnt scroll anymore after resize and the display continues to hold wierd colors and shows patchy image if partially obscured by another window.
I have contacted engineer Jeannette Hung over this issue and She said the problem was that the clip state was not being validated in RasterOutputManager.renderImage(). I am not sure if this problem might also be with the way ScrollPane is implemented. Its is a serious bug (filed as P2 in our category) and needs to be fixed by our FCS.
Name: dsC76792 Date: 09/17/99
###@###.###
Here is a simplified test case that reproduces the same problem.
It's not so easy to make the color change by resizing, but it
clearly manifests when scrolling.
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
public class DisplayTest extends Component {
public static final int WIDTH = 500;
public static final int HEIGHT = 500;
BufferedImage bufferedimage = new BufferedImage(WIDTH, HEIGHT,
BufferedImage.TYPE_3BYTE_BGR);
public DisplayTest() {
DataBuffer buffer = bufferedimage.getRaster().getDataBuffer();
for (int i = 2; i < buffer.getSize(); i+=3) {
buffer.setElem(i - 2, 255);
buffer.setElem(i - 1, 0);
buffer.setElem(i, 0);
}
}
public void paint(Graphics g) {
g.setClip(0, 0, WIDTH, HEIGHT);
g.drawImage(bufferedimage, 0, 0, this);
}
public Dimension getPreferredSize() {
return new Dimension(WIDTH, HEIGHT);
}
public static void main(String args[]) {
Frame frame = new Frame("Test");
ScrollPane scrollPane = new ScrollPane();
scrollPane.add(new DisplayTest());
frame.add(scrollPane);
frame.pack();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
frame.setVisible(true);
}
}
The setClip() call in paint() matters. The exact clip rectangle isn't
important, but the left-top corner of the new clip should differ from
the left-top corner of the original clip for the bug to manifest.
======================================================================
- relates to
-
JDK-4278201 ScrollPane behaves inconsistently on Solaris
- Closed