[5410] in java-interest

home help back first fref pref prev next nref lref last post

Re: Synchronous image drawing questions

daemon@ATHENA.MIT.EDU (Jim Graham)
Thu Feb 8 00:47:23 1996

Date: Wed, 7 Feb 1996 20:37:15 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, bnm@bbt.com


Hi Brian,

> 1) Since Graphics.drawImage() works asynchronously, code immediately following
> its invocation can not assume the image is drawn.  I understand that various
> combinations of Component's imageUpdate(), prepareImage(), and/or checkImage()
> can be used to both start and signal the finish of an image's download.  I'll
> use these if I have to, but I'm hoping someone can point out an easier way to
> synchronously draw an image.

Try using the java.awt.MediaTracker class and read:

	http://www.javasoft.com/JDK-beta/converting/images.html

> 2) Is it safe to assume that drawImage() *does* draw synchoronously if the
> image has already been prepared previously, either by complete downloading
> or rendering off-screen?

Simply rendering off-screen won't guarantee that it has completely loaded.

drawImage() always returns immediately, but it may have only drawn part of
the image if it has not yet completed downloading.  The MediaTracker gives
you a way to figure out if downloading is complete.

> 3) Short of examining the file, is there any way in Java to tell if a .gif
> is interlaced?  Would the sequence of imageUpdate() callbacks give any
> indication?

There are no interfaces for this.  You could probably deduce it from the
pattern of imageUpdate callbacks, but the image may have been previously
partially downloaded and so even the callbacks may come in partially in a
different order...

				...jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post