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.ImageProducer
ThisImageProducer
represents an animated image. At one point in timejava.awt.image.MemoryImageSource
did not perform this duty to my satisfaction and soAnimBuffProducer
was created.
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_pix
The 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 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 registeredImageConsumer
objects 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.IllegalMonitorStateException
The current state of the image will be pushed through to all registeredImageConsumer
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 which rectangular region is specified. However, pixel data is only pushed to
ImageConsumer
objects in this call, regardless of whether those consumers are new or preexisting.If
areaChanged
is 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:
addConsumer
in interfacejava.awt.image.ImageProducer
-
isConsumer
public boolean isConsumer(java.awt.image.ImageConsumer ic)
- Specified by:
isConsumer
in interfacejava.awt.image.ImageProducer
-
removeConsumer
public void removeConsumer(java.awt.image.ImageConsumer ic)
- Specified by:
removeConsumer
in interfacejava.awt.image.ImageProducer
-
startProduction
public void startProduction(java.awt.image.ImageConsumer ic)
- Specified by:
startProduction
in interfacejava.awt.image.ImageProducer
-
requestTopDownLeftRightResend
public void requestTopDownLeftRightResend(java.awt.image.ImageConsumer ic)
- Specified by:
requestTopDownLeftRightResend
in interfacejava.awt.image.ImageProducer
-
-