Image Observer

Can someone tell me what the term image observer refers to. I notice in the constructor of TBuffered image that the last parameter refers to the image observer. Thanks Chip
[201 byte] By [JavaChipa] at [2007-9-28 11:33:28]
# 1

ImageObserver is an interface that support asynchronous (non-blocking) image loading. This was probably originally to support applets, but in many cases it is a pain when you simply want synchronous (blocking) loading of images.

So if you use Component.createImage(URL) to get an Image, and then attempt to do something with it, for instance, image.getWidth(imageObserver) or Graphics.drawImage(image, x, y, imageObserver), Java may still be waiting for the image to load, so getWidth() will return -1 to tell you it doesn't yet know the width, and when the width *is* available the imageObserver will be called to tell it that it knows the width now.

I have rarely used ImageObservers for more than waiting for an image to load, and you can usually pass null as the ImageObserver if you don't care to be notified when the image is updated.

cdbennetta at 2007-7-12 2:13:28 > top of Java-index,Other Topics,Java Game Development...
# 2
Thank you for the awesome answer!Chip
JavaChipa at 2007-7-12 2:13:28 > top of Java-index,Other Topics,Java Game Development...
# 3
Yes, thank you indeed :)
darconea at 2007-7-12 2:13:28 > top of Java-index,Other Topics,Java Game Development...