Package com.nerius.img
Class AnimBuffProducer
- java.lang.Object
-
- com.nerius.img.AnimBuffProducer
-
- All Implemented Interfaces:
java.awt.image.ImageProducer
public class AnimBuffProducer extends java.lang.Object implements java.awt.image.ImageProducerThisImageProducerrepresents an animated image. At one point in timejava.awt.image.MemoryImageSourcedid not perform this duty to my satisfaction and soAnimBuffProducerwas created.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]m_pixThe pixel buffer which is passed into constructor is made accessible to subclasses which extendAnimBuffProducer.
-
Constructor Summary
Constructors Constructor Description AnimBuffProducer(int[] pix, int width, int height, java.awt.image.ColorModel clrModel)Orientation: .imagePixel(x,y) = pix[y*width + x]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConsumer(java.awt.image.ImageConsumer ic)java.awt.image.ColorModelgetColorModel()intgetHeight()intgetWidth()booleanisConsumer(java.awt.image.ImageConsumer ic)voidremoveConsumer(java.awt.image.ImageConsumer ic)voidrequestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)voidstartProduction(java.awt.image.ImageConsumer ic)voidtriggerFrame(java.awt.Rectangle areaChanged)The current state of the image will be pushed through to all registeredImageConsumerobjects as the next frame in a multi-frame image when this method is called.
-
-
-
Method Detail
-
triggerFrame
public void triggerFrame(java.awt.Rectangle areaChanged) throws java.lang.IllegalMonitorStateExceptionThe current state of the image will be pushed through to all registeredImageConsumerobjects 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 which rectangular region is specified. However, pixel data is only pushed to
ImageConsumerobjects in this call, regardless of whether those consumers are new or preexisting.If
areaChangedis null, the entire pixel buffer will be delivered; it is equivalent to the calltriggerFrame(new Rectangle(0, 0, getWidth(), getHeight()));
This method should only be called by a single thread.
- Throws:
java.lang.IllegalMonitorStateException- if this method is called while another thread is still executing this method.
-
getWidth
public int getWidth()
-
getHeight
public int getHeight()
-
getColorModel
public java.awt.image.ColorModel getColorModel()
-
addConsumer
public void addConsumer(java.awt.image.ImageConsumer ic)
- Specified by:
addConsumerin interfacejava.awt.image.ImageProducer
-
isConsumer
public boolean isConsumer(java.awt.image.ImageConsumer ic)
- Specified by:
isConsumerin interfacejava.awt.image.ImageProducer
-
removeConsumer
public void removeConsumer(java.awt.image.ImageConsumer ic)
- Specified by:
removeConsumerin interfacejava.awt.image.ImageProducer
-
startProduction
public void startProduction(java.awt.image.ImageConsumer ic)
- Specified by:
startProductionin interfacejava.awt.image.ImageProducer
-
requestTopDownLeftRightResend
public void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
- Specified by:
requestTopDownLeftRightResendin interfacejava.awt.image.ImageProducer
-
-