Class AnimBuffProducer

  extended by com.nerius.img.AnimBuffProducer
All Implemented Interfaces:

public class AnimBuffProducer
extends java.lang.Object
implements java.awt.image.ImageProducer

java.awt.image.MemoryImageSource wins the "worst class ever written" award; this class and BuffProducer intend to outrobustify MemoryImageSource.

See Also:

Field Summary
protected  int[] m_pix
Constructor Summary
AnimBuffProducer(int[] pix, int width, int height, java.awt.image.ColorModel clrModel)
          Orientation: imagePixel(x, y) = pix[y * width + x].
Method Summary
 void addConsumer(java.awt.image.ImageConsumer ic)
 java.awt.image.ColorModel getColorModel()
 int getHeight()
 int getWidth()
 boolean isConsumer(java.awt.image.ImageConsumer ic)
 void removeConsumer(java.awt.image.ImageConsumer ic)
 void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
 void startProduction(java.awt.image.ImageConsumer ic)
 void triggerFrame(java.awt.Rectangle areaChanged)
          The current state of the image will be pushed through to all registered ImageConsumer objects as the next frame in a multi-frame image when this method is called.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected final int[] m_pix
Constructor Detail


public AnimBuffProducer(int[] pix,
                        int width,
                        int height,
                        java.awt.image.ColorModel clrModel)
Orientation: imagePixel(x, y) = pix[y * width + x].

Method Detail


public void triggerFrame(java.awt.Rectangle areaChanged)
                  throws java.lang.IllegalMonitorStateException
The current state of the image will be pushed through to all registered ImageConsumer objects as the next frame in a multi-frame image when this method is called. The pixel information is delivered to all consumers in the same thread that calls this method. Only the specified rectangle of pixels will be delivered to listening consumers, leaving the area outside of the specified rectangle unchanged from the last frame. The first time a consumer receives pixel information, it gets the entire pixel buffer, no matter what rectangular region is specified.

If areaChanged == null, the entire pixel buffer will be delivered; it is equivalent to the call

 triggerFrame(new Rectangle(0, 0, getWidth(), getHeight()));

This method should only be called by a single thread.

java.lang.IllegalMonitorStateException - if this method is called while another thread is still executing this method.


public int getWidth()


public int getHeight()


public java.awt.image.ColorModel getColorModel()


public void addConsumer(java.awt.image.ImageConsumer ic)
Specified by:
addConsumer in interface java.awt.image.ImageProducer


public boolean isConsumer(java.awt.image.ImageConsumer ic)
Specified by:
isConsumer in interface java.awt.image.ImageProducer


public void removeConsumer(java.awt.image.ImageConsumer ic)
Specified by:
removeConsumer in interface java.awt.image.ImageProducer


public void startProduction(java.awt.image.ImageConsumer ic)
Specified by:
startProduction in interface java.awt.image.ImageProducer


public void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
Specified by:
requestTopDownLeftRightResend in interface java.awt.image.ImageProducer