The PixelGrabber class is an ImageConsumer that captures the pixels from an image and saves them in an array.
public class java.awt.image.PixelGrabber extends java.lang.Object implements java.awt.image.ImageConsumer { // Constructors public PixelGrabber (Image img, int x, int y, int w, int h, boolean forceRGB); public PixelGrabber (Image image, int x, int y, int width, int height, int[] pixels, int offset, int scansize); public PixelGrabber (ImageProducer ip, int x, int y, int width, int height, int[] pixels, int offset, int scansize); // Instance Methods public synchronized void abortGrabbing(); public synchronized ColorModel getColorModel(); public synchronized int getHeight(); public synchronized Object getPixels(); public synchronized int getStatus(); public synchronized int getWidth(); public boolean grabPixels() throws InterruptedException; public synchronized boolean grabPixels (long ms) throws InterruptedException; public synchronized void imageComplete (int status); public void setColorModel (ColorModel model); public void setDimensions (int width, int height); public void setHints (int hints); public void setPixels (int x, int y, int width, int height, ColorModel model, byte[] pixels, int offset, int scansize); public void setPixels (int x, int y, int width, int height, ColorModel model, int[] pixels, int offset, int scansize); public void setProperties (Hashtable properties); public synchronized void startGrabbing(); public synchronized int status(); }
Image to use as source of pixel data.
x-coordinate of top-left corner of pixel data.
y-coordinate of top-left corner of pixel data.
Width of pixel data.
Height of pixel data.
true to force the use of the RGB color model; false otherwise.
Constructs a PixelGrabber instance to grab the specified area of the image.
Image to use as source of pixel data.
x-coordinate of top-left corner of pixel data.
y-coordinate of top-left corner of pixel data.
Width of pixel data.
Height of pixel data.
Where to store pixel data when grabPixels() called.
Offset from beginning of each line in pixels array.
Size of each line of data in pixels array.
Constructs a PixelGrabber instance to grab the specified area of the image and store the pixel data from this area in the array pixels[].
ImageProducer to use as source of pixel data.
x-coordinate of top-left corner of pixel data.
y-coordinate of top-left corner of pixel data.
Width of pixel data.
Height of pixel data.
Where to store pixel data when grabPixels() called.
Offset from beginning of each line in pixels array.
Size of each line of data in pixels array.
Constructs a PixelGrabber instance to grab data from the specified area of the image generated by an ImageProducer and store the pixel data from this area in the array pixels[].
Stops the PixelGrabber's image-grabbing process.
The color model the PixelGrabber is using for its array.
The height of the grabbed image, or -1 if the height is not known.
The array of pixels.
Either a byte array or an integer array is returned, or null if the size and format of the image are not yet known. Because the PixelGrabber may change its mind about what ColorModel it's using, different calls to this method may return different arrays until the image acquisition is complete.
A combination of ImageObserver flags indicating what data is available.
The width of the grabbed image, or -1 if the width is not known.
If image grabbing is interrupted before completion.
true if the image has completed loading, false if the loading process aborted or an error occurred.
Starts the process of grabbing the pixel data from the source and storing it in the array pixels[] from constructor. Returns when the image is complete, loading aborts, or an error occurs.
Milliseconds to wait for completion.
true if image has completed loading, false if the loading process aborted, or an error or a timeout occurred.
If image grabbing is interrupted before completion.
Starts the process of grabbing the pixel data from the source and storing it in the array pixels[] from constructor. Returns when the image is complete, loading aborts, an error occurs, or a timeout occurs.
Image loading completion status flags.
ImageConsumer.imageComplete(int)
Called by the ImageProducer to indicate that the image has been delivered.
The color model for the image.
ImageConsumer.setColorModel(ColorModel)
Does nothing.
Width for image.
Height for image.
ImageConsumer.setDimensions(int, int)
Does nothing.
Image consumption hints.
ImageConsumer.setHints(int)
Does nothing.
x-coordinate of top-left corner of pixel data delivered with this method call.
y-coordinate of top-left corner of pixel data delivered with this method call.
Width of the rectangle of pixel data delivered with this method call.
Height of the rectangle of pixel data delivered with this method call.
Color model of image data.
Image data.
Offset from beginning of the pixels array.
Size of each line of data in pixels array.
ImageConsumer.setPixels(int, int, int, int, ColorModel, byte[], int, int)
Called by the ImageProducer to deliver pixel data from the image.
x-coordinate of top-left corner of pixel data delivered with this method call.
y-coordinate of top-left corner of pixel data delivered with this method call.
Width of the rectangle of pixel data delivered with this method call.
Height of the rectangle of pixel data delivered with this method call.
Color model of image data.
Image data.
Offset from beginning of the pixels array.
Size of each line of data in pixels array.
ImageConsumer.setPixels(int, int, int, int, ColorModel, int[], int, int)
Called by the ImageProducer to deliver pixel data from the image.
The properties for the image.
ImageConsumer.setProperties(Hashtable)
Does nothing.
Starts the PixelGrabber's image-grabbing process.
The ImageObserver flags OR'ed together representing the available information about the image. Replaced by getStatus().
ColorModel, Hashtable, Image, ImageConsumer, ImageProducer, InterruptedException, MemoryImageSource, Object