[3233] in java-interest

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

Re: ImageProducer/Consumer classes

daemon@ATHENA.MIT.EDU (Jim Graham)
Fri Nov 3 22:45:43 1995

Date: Fri, 3 Nov 1995 17:39:27 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, dgourley@CS.Berkeley.EDU


Hi David,

> I understand that I can implement the producer interface which can go off
> and get the frames and then call the appropriate method in the consumer
> class notifying that a frame has arrived and is ready, the part I am not
> sure about is that once a frame has arrived the consumer must either notify
> or arrange for it to be displayed. Should it create an Image for each frame
> and then display? This seems inefficient, there must be a cleaner way to do
> this, but I just dont see it. Any help would be appreciated.

When you create an image from an ImageProducer using

	Component.createImage(ImageProducer)

you get back a handle to something that will take care of managing the
ImageConsumers needed to get the bits to the screen on its own.  These
ImageConsumers will also take care of notifying applets that are drawing
the image that a new frame is available using the ImageObserver notification
mechanism.

So, all you have to worry about is writing the ImageProducer and then
creating one image for it using the above method and from then on that
one image will be the way to draw each successive frame.

				...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