-
Bug
-
Resolution: Fixed
-
P4
-
1.1.4
-
1.1.6
-
x86
-
windows_95
-
Verified
Name: sg39081 Date: 10/21/97
======================================================================
New report to replace the 2 emails below:
drawImage(Image, int, int, int, int) fills the canvas
with black before drawing a scaled image if the full-sized
image hasn't been fully prepared.
This only affects Windows 95: Solaris and Linux are OK.
The problem is new in 1.1: JDK 1.0.2 is OK.
For demos and sample code see:
http://www.tigress.co.uk/rmy/10buggy/PanView.html
======================================================================
Name: sg39081 Date: 10/20/97
The versions of drawImage with signatures
drawImage(Image, int, int, int, int, ImageObserver)
drawImage(Image, int, int, int, int, int, int, int, int, ImageObserver)
(and possibly others which I haven't tried) cause the canvas to
be redrawn in black before the image is drawn. This happens
with the appletviewer on Windows 95 with JDK 1.1.4. The
appletviewer in IBM's Visual Age for Java doesn't exhibit this
behaviour. The JDKs on Solaris and Linux are also OK.
Here's some source (http://www.tigress.co.uk/rmy/buggy):
import java.applet.* ;
import java.util.* ;
import java.awt.* ;
public class PanView extends Applet {
PanCanvas panCanvas ;
public void init() {
// set up the display
setLayout(new BorderLayout()) ;
panCanvas = new PanCanvas(this) ;
add("Center", panCanvas) ;
validate() ;
}
}
import java.net.* ;
import java.awt.* ;
import java.awt.image.* ;
import java.util.* ;
public class PanCanvas extends Canvas {
private PanView pan ;
private int width ;
private int height ;
private int imw ;
private int imh ;
private Image im ;
PanCanvas(PanView pan) {
this.pan = pan ;
String file = pan.getParameter("panoramaFile") ;
width = Integer.parseInt(pan.getParameter("panWidth")) ;
height = Integer.parseInt(pan.getParameter("panHeight")) ;
imw = Integer.parseInt(pan.getParameter("imageWidth")) ;
imh = Integer.parseInt(pan.getParameter("imageHeight")) ;
resize(width, height) ;
// create the image
im = pan.getImage(pan.getDocumentBase(), file) ;
}
final public void update(Graphics g) {
paint(g) ;
}
final public void paint(Graphics g) {
if ( im != null ) {
// g.drawImage(im, 0, 0, width, height, 0, 0, width, height, this) ;
g.drawImage(im, 0, 0, width, height, this) ;
// g.drawImage(im, 0, 0, this) ;
}
}
}
======================================================================
Another email 10/21/97:
I've since investigated this further and have found that the blanking
effect occurs if a scaled image is drawn when the original, unscaled
image hasn't been fully prepared for rendering. This allows me to
work around the problem by ensuring that the unscaled image has been
prepared before trying to draw a scaled image. This workaround doesn't
work with the Microsoft 1.1 VM, though it does with the Sun and Netscape
ones.
Yesterday I submitted a further bug report to that effect. See
http://www.tigress.co.uk/rmy/10buggy/PanView.html for details.
======================================================================