The MemoryImageSource class allows you to create images completely in memory. You provide an array of data; it serves as an image producer for that data. In the 1.1 release, new methods support using this class for animation (notably setAnimated() and the various overrides of newPixels()).
public class java.awt.image.MemoryImageSource extends java.lang.Object implements java.awt.image.ImageProducer { // Constructors public MemoryImageSource (int w, int h, ColorModel cm, byte[] pix, int off, int scan); public MemoryImageSource (int w, int h, ColorModel cm, byte[] pix, int off, int scan, Hashtable props); public MemoryImageSource (int w, int h, ColorModel cm, int[] pix, int off, int scan); public MemoryImageSource (int w, int h, ColorModel cm, int[] pix, int off, int scan, Hashtable props); public MemoryImageSource (int w, int h, int[] pix, int off, int scan); public MemoryImageSource (int w, int h, int[] pix, int off, int scan, Hashtable props); // Instance Methods public synchronized void addConsumer (ImageConsumer ic); public synchronized boolean isConsumer (ImageConsumer ic); public void newPixels(); public synchronized void newPixels (int x, int y, int w, int h); public synchronized void newPixels (int x, int y, int w, int h, boolean framenotify); public synchronized void newPixels (byte[] newpix, ColorModel newmodel, int offset, int scansize); public synchronized void newPixels (int[] newpix, ColorModel newmodel, int offset, int scansize); public synchronized void removeConsumer (ImageConsumer ic); public void requestTopDownLeftRightResend (ImageConsumer ic); public synchronized void setAnimated (boolean animated); public synchronized void setFullBufferUpdates (boolean fullbuffers); public void startProduction (ImageConsumer ic); }
Width of the image being created.
Height of the image being created.
ColorModel of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
Width of the image being created.
Height of the image being created.
ColorModel of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Hashtable of properties associated with image.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
Width of the image being created.
Height of the image being created.
ColorModel of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
Width of the image being created.
Height of the image being created.
ColorModel of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Hashtable of properties associated with image.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
Width of the image being created.
Height of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
Width of the image being created.
Height of the image being created.
Array of pixel information.
The offset of the first pixel in the array; elements prior to this pixel are ignored.
The number of pixels per scan line in the array.
Hashtable of properties associated with image.
Constructs a MemoryImageSource object with the given parameters to serve as an ImageProducer for a new image.
ImageConsumer requesting image data.
ImageProducer.addConsumer(ImageConsumer)
Registers an ImageConsumer as interested in Image information.
ImageConsumer to check.
true if ImageConsumer is registered with this ImageProducer, false otherwise.
ImageProducer.isConsumer(ImageConsumer)
Notifies the MemoryImageSource that there is new data available. The MemoryImageSource notifies all ImageConsumers that there is new data, sending the full rectangle and notifying the consumers that the frame is complete.
x coordinate of the top left corner of the new image data.
y coordinate of the top left corner of the new image data.
Width of the new image data.
Height of the new image data.
Notifies the MemoryImageSource that there is new data available. The MemoryImageSource notifies all ImageConsumers that there is new data in the rectangle described by x, y, w, and h. The consumers are notified that the frame is complete.
x coordinate of the top left corner of the new image data.
y coordinate of the top left corner of the new image data.
Width of the new image data.
Height of the new image data.
Determines whether this is a complete frame or not.
Notifies the MemoryImageSource that there is new data available. The MemoryImageSource notifies all ImageConsumers that there is new data in the rectangle described by x, y, w, and h. If framenotify is true, the consumers will also be notified that a frame is complete.
New array of image data.
The color model to use for the new data.
Offset into the data array
Size of each line.
Changes the image data for this MemoryImageSource and notifies its ImageConsumers that new data is available.
New array of image data.
The color model to use for the new data.
Offset into the data array
Size of each line.
Changes the image data for this MemoryImageSource and notifies its ImageConsumers that new data is available.
ImageConsumer to remove.
ImageProducer.removeConsumer(ImageConsumer)
Removes an ImageConsumer from registered consumers for this ImageProducer.
ImageConsumer requesting image data.
ImageProducer.requestTopDownLeftRightResend(ImageConsumer)
Requests the retransmission of the Image data in top-down, left-to-right order.
Flag indicating whether this image is animated.
To use this MemoryImageSource for animation, call setAnimated(true). The newPixels() methods will not work otherwise.
true to send full buffers; false otherwise.
This method is only important for animations; i.e., you should call setAnimated(true) before using this function. If you do request to send full buffers, then any rectangle parameters passed to newPixels() will be ignored and the entire image will be sent to the consumers.
ImageConsumer requesting image data.
ImageProducer.startProduction(ImageConsumer)
Registers ImageConsumer as interested in Image information and tells ImageProducer to start sending the image data immediately.
ColorModel, Hashtable, ImageConsumer, ImageProducer, Object
This HTML Help has been published using the chm2web software. |