java.awt.image
Class PixelGrabber

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.awt.image.PixelGrabber
All Implemented Interfaces:
ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer

public class PixelGrabber
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer

The PixelGrabber class implements an ImageConsumer which can be attached to an Image or ImageProducer object to retrieve a subset of the pixels in that image. Here is an example:


 public void handlesinglepixel(int x, int y, int pixel) {
        int alpha = (pixel >> 24) & 0xff;
        int red   = (pixel >> 16) & 0xff;
        int green = (pixel >>  8) & 0xff;
        int blue  = (pixel      ) & 0xff;
        // Deal with the pixel as necessary...
 }

 public void handlepixels(Image img, int x, int y, int w, int h) {
        int[] pixels = new int[w * h];
        PixelGrabber pg = new PixelGrabber(img, x, y, w, h, pixels, 0, w);
        try {
            pg.grabPixels();
        } catch (InterruptedException e) {
            System.err.println("interrupted waiting for pixels!");
            return;
        }
        if ((pg.getStatus() & ImageObserver.ABORT) != 0) {
            System.err.println("image fetch aborted or errored");
            return;
        }
        for (int j = 0; j < h; j++) {
            for (int i = 0; i < w; i++) {
                handlesinglepixel(x+i, y+j, pixels[j * w + i]);
            }
        }
 }

 

See Also:
ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault()

Field Summary
 
Fields inherited from interface java.awt.image.ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
COMPLETESCANLINES sample code for java.awt.image.ImageConsumer.COMPLETESCANLINES definition code for java.awt.image.ImageConsumer.COMPLETESCANLINES , IMAGEABORTED sample code for java.awt.image.ImageConsumer.IMAGEABORTED definition code for java.awt.image.ImageConsumer.IMAGEABORTED , IMAGEERROR sample code for java.awt.image.ImageConsumer.IMAGEERROR definition code for java.awt.image.ImageConsumer.IMAGEERROR , RANDOMPIXELORDER sample code for java.awt.image.ImageConsumer.RANDOMPIXELORDER definition code for java.awt.image.ImageConsumer.RANDOMPIXELORDER , SINGLEFRAME sample code for java.awt.image.ImageConsumer.SINGLEFRAME definition code for java.awt.image.ImageConsumer.SINGLEFRAME , SINGLEFRAMEDONE sample code for java.awt.image.ImageConsumer.SINGLEFRAMEDONE definition code for java.awt.image.ImageConsumer.SINGLEFRAMEDONE , SINGLEPASS sample code for java.awt.image.ImageConsumer.SINGLEPASS definition code for java.awt.image.ImageConsumer.SINGLEPASS , STATICIMAGEDONE sample code for java.awt.image.ImageConsumer.STATICIMAGEDONE definition code for java.awt.image.ImageConsumer.STATICIMAGEDONE , TOPDOWNLEFTRIGHT sample code for java.awt.image.ImageConsumer.TOPDOWNLEFTRIGHT definition code for java.awt.image.ImageConsumer.TOPDOWNLEFTRIGHT
 
Constructor Summary
PixelGrabber sample code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.Image, int, int, int, int, boolean) definition code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.Image, int, int, int, int, boolean) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, int w, int h, boolean forceRGB)
          Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image.
PixelGrabber sample code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int) definition code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int) (Image sample code for java.awt.Image definition code for java.awt.Image  img, int x, int y, int w, int h, int[] pix, int off, int scansize)
          Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array.
PixelGrabber sample code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int) definition code for java.awt.image.PixelGrabber.PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int) (ImageProducer sample code for java.awt.image.ImageProducer definition code for java.awt.image.ImageProducer  ip, int x, int y, int w, int h, int[] pix, int off, int scansize)
          Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array.
 
Method Summary
 void abortGrabbing sample code for java.awt.image.PixelGrabber.abortGrabbing() definition code for java.awt.image.PixelGrabber.abortGrabbing() ()
          Request the PixelGrabber to abort the image fetch.
 ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel getColorModel sample code for java.awt.image.PixelGrabber.getColorModel() definition code for java.awt.image.PixelGrabber.getColorModel() ()
          Get the ColorModel for the pixels stored in the array.
 int getHeight sample code for java.awt.image.PixelGrabber.getHeight() definition code for java.awt.image.PixelGrabber.getHeight() ()
          Get the height of the pixel buffer (after adjusting for image height).
 Object sample code for java.lang.Object definition code for java.lang.Object getPixels sample code for java.awt.image.PixelGrabber.getPixels() definition code for java.awt.image.PixelGrabber.getPixels() ()
          Get the pixel buffer.
 int getStatus sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus() ()
          Return the status of the pixels.
 int getWidth sample code for java.awt.image.PixelGrabber.getWidth() definition code for java.awt.image.PixelGrabber.getWidth() ()
          Get the width of the pixel buffer (after adjusting for image width).
 boolean grabPixels sample code for java.awt.image.PixelGrabber.grabPixels() definition code for java.awt.image.PixelGrabber.grabPixels() ()
          Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.
 boolean grabPixels sample code for java.awt.image.PixelGrabber.grabPixels(long) definition code for java.awt.image.PixelGrabber.grabPixels(long) (long ms)
          Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed.
 void imageComplete sample code for java.awt.image.PixelGrabber.imageComplete(int) definition code for java.awt.image.PixelGrabber.imageComplete(int) (int status)
          The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setColorModel sample code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel) definition code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel) (ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model)
          The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setDimensions sample code for java.awt.image.PixelGrabber.setDimensions(int, int) definition code for java.awt.image.PixelGrabber.setDimensions(int, int) (int width, int height)
          The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setHints sample code for java.awt.image.PixelGrabber.setHints(int) definition code for java.awt.image.PixelGrabber.setHints(int) (int hints)
          The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setPixels sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) (int srcX, int srcY, int srcW, int srcH, ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model, byte[] pixels, int srcOff, int srcScan)
          The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setPixels sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) (int srcX, int srcY, int srcW, int srcH, ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model, int[] pixels, int srcOff, int srcScan)
          The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void setProperties sample code for java.awt.image.PixelGrabber.setProperties(java.util.Hashtable) definition code for java.awt.image.PixelGrabber.setProperties(java.util.Hashtable) (Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable <?,?> props)
          The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.
 void startGrabbing sample code for java.awt.image.PixelGrabber.startGrabbing() definition code for java.awt.image.PixelGrabber.startGrabbing() ()
          Request the PixelGrabber to start fetching the pixels.
 int status sample code for java.awt.image.PixelGrabber.status() definition code for java.awt.image.PixelGrabber.status() ()
          Returns the status of the pixels.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

PixelGrabber sample code for java.awt.image.PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int) definition code for java.awt.image.PixelGrabber(java.awt.Image, int, int, int, int, int[], int, int)

public PixelGrabber(Image sample code for java.awt.Image definition code for java.awt.Image  img,
                    int x,
                    int y,
                    int w,
                    int h,
                    int[] pix,
                    int off,
                    int scansize)
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at pix[(j - y) * scansize + (i - x) + off].

Parameters:
img - the image to retrieve pixels from
x - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w - the width of the rectangle of pixels to retrieve
h - the height of the rectangle of pixels to retrieve
pix - the array of integers which are to be used to hold the RGB pixels retrieved from the image
off - the offset into the array of where to store the first pixel
scansize - the distance from one row of pixels to the next in the array
See Also:
ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault()

PixelGrabber sample code for java.awt.image.PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int) definition code for java.awt.image.PixelGrabber(java.awt.image.ImageProducer, int, int, int, int, int[], int, int)

public PixelGrabber(ImageProducer sample code for java.awt.image.ImageProducer definition code for java.awt.image.ImageProducer  ip,
                    int x,
                    int y,
                    int w,
                    int h,
                    int[] pix,
                    int off,
                    int scansize)
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the image produced by the specified ImageProducer into the given array. The pixels are stored into the array in the default RGB ColorModel. The RGB data for pixel (i, j) where (i, j) is inside the rectangle (x, y, w, h) is stored in the array at pix[(j - y) * scansize + (i - x) + off].

Parameters:
ip - the ImageProducer that produces the image from which to retrieve pixels
x - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w - the width of the rectangle of pixels to retrieve
h - the height of the rectangle of pixels to retrieve
pix - the array of integers which are to be used to hold the RGB pixels retrieved from the image
off - the offset into the array of where to store the first pixel
scansize - the distance from one row of pixels to the next in the array
See Also:
ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault()

PixelGrabber sample code for java.awt.image.PixelGrabber(java.awt.Image, int, int, int, int, boolean) definition code for java.awt.image.PixelGrabber(java.awt.Image, int, int, int, int, boolean)

public PixelGrabber(Image sample code for java.awt.Image definition code for java.awt.Image  img,
                    int x,
                    int y,
                    int w,
                    int h,
                    boolean forceRGB)
Create a PixelGrabber object to grab the (x, y, w, h) rectangular section of pixels from the specified image. The pixels are accumulated in the original ColorModel if the same ColorModel is used for every call to setPixels, otherwise the pixels are accumulated in the default RGB ColorModel. If the forceRGB parameter is true, then the pixels will be accumulated in the default RGB ColorModel anyway. A buffer is allocated by the PixelGrabber to hold the pixels in either case. If (w < 0) or (h < 0), then they will default to the remaining width and height of the source data when that information is delivered.

Parameters:
img - the image to retrieve the image data from
x - the x coordinate of the upper left corner of the rectangle of pixels to retrieve from the image, relative to the default (unscaled) size of the image
y - the y coordinate of the upper left corner of the rectangle of pixels to retrieve from the image
w - the width of the rectangle of pixels to retrieve
h - the height of the rectangle of pixels to retrieve
forceRGB - true if the pixels should always be converted to the default RGB ColorModel
Method Detail

startGrabbing sample code for java.awt.image.PixelGrabber.startGrabbing() definition code for java.awt.image.PixelGrabber.startGrabbing()

public void startGrabbing()
Request the PixelGrabber to start fetching the pixels.


abortGrabbing sample code for java.awt.image.PixelGrabber.abortGrabbing() definition code for java.awt.image.PixelGrabber.abortGrabbing()

public void abortGrabbing()
Request the PixelGrabber to abort the image fetch.


grabPixels sample code for java.awt.image.PixelGrabber.grabPixels() definition code for java.awt.image.PixelGrabber.grabPixels()

public boolean grabPixels()
                   throws InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException 
Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered.

Returns:
true if the pixels were successfully grabbed, false on abort, error or timeout
Throws:
InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException - Another thread has interrupted this thread.

grabPixels sample code for java.awt.image.PixelGrabber.grabPixels(long) definition code for java.awt.image.PixelGrabber.grabPixels(long)

public boolean grabPixels(long ms)
                   throws InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException 
Request the Image or ImageProducer to start delivering pixels and wait for all of the pixels in the rectangle of interest to be delivered or until the specified timeout has elapsed. This method behaves in the following ways, depending on the value of ms:

Parameters:
ms - the number of milliseconds to wait for the image pixels to arrive before timing out
Returns:
true if the pixels were successfully grabbed, false on abort, error or timeout
Throws:
InterruptedException sample code for java.lang.InterruptedException definition code for java.lang.InterruptedException - Another thread has interrupted this thread.

getStatus sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus()

public int getStatus()
Return the status of the pixels. The ImageObserver flags representing the available pixel information are returned.

Returns:
the bitwise OR of all relevant ImageObserver flags
See Also:
ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver

getWidth sample code for java.awt.image.PixelGrabber.getWidth() definition code for java.awt.image.PixelGrabber.getWidth()

public int getWidth()
Get the width of the pixel buffer (after adjusting for image width). If no width was specified for the rectangle of pixels to grab then then this information will only be available after the image has delivered the dimensions.

Returns:
the final width used for the pixel buffer or -1 if the width is not yet known
See Also:
getStatus() sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus()

getHeight sample code for java.awt.image.PixelGrabber.getHeight() definition code for java.awt.image.PixelGrabber.getHeight()

public int getHeight()
Get the height of the pixel buffer (after adjusting for image height). If no width was specified for the rectangle of pixels to grab then then this information will only be available after the image has delivered the dimensions.

Returns:
the final height used for the pixel buffer or -1 if the height is not yet known
See Also:
getStatus() sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus()

getPixels sample code for java.awt.image.PixelGrabber.getPixels() definition code for java.awt.image.PixelGrabber.getPixels()

public Object sample code for java.lang.Object definition code for java.lang.Object  getPixels()
Get the pixel buffer. If the PixelGrabber was not constructed with an explicit pixel buffer to hold the pixels then this method will return null until the size and format of the image data is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data, the array object returned by this method may change over time until the image grab is complete.

Returns:
either a byte array or an int array
See Also:
getStatus() sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus() , setPixels(int, int, int, int, ColorModel, byte[], int, int) sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) , setPixels(int, int, int, int, ColorModel, int[], int, int) sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)

getColorModel sample code for java.awt.image.PixelGrabber.getColorModel() definition code for java.awt.image.PixelGrabber.getColorModel()

public ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  getColorModel()
Get the ColorModel for the pixels stored in the array. If the PixelGrabber was constructed with an explicit pixel buffer then this method will always return the default RGB ColorModel, otherwise it may return null until the ColorModel used by the ImageProducer is known. Since the PixelGrabber may fall back on accumulating the data in the default RGB ColorModel at any time if the source image uses more than one ColorModel to deliver the data, the ColorModel object returned by this method may change over time until the image grab is complete and may not reflect any of the ColorModel objects that was used by the ImageProducer to deliver the pixels.

Returns:
the ColorModel object used for storing the pixels
See Also:
getStatus() sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus() , ColorModel.getRGBdefault() sample code for java.awt.image.ColorModel.getRGBdefault() definition code for java.awt.image.ColorModel.getRGBdefault() , setColorModel(ColorModel) sample code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel) definition code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel)

setDimensions sample code for java.awt.image.PixelGrabber.setDimensions(int, int) definition code for java.awt.image.PixelGrabber.setDimensions(int, int)

public void setDimensions(int width,
                          int height)
The setDimensions method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setDimensions sample code for java.awt.image.ImageConsumer.setDimensions(int, int) definition code for java.awt.image.ImageConsumer.setDimensions(int, int) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
width - the width of the dimension
height - the height of the dimension

setHints sample code for java.awt.image.PixelGrabber.setHints(int) definition code for java.awt.image.PixelGrabber.setHints(int)

public void setHints(int hints)
The setHints method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setHints sample code for java.awt.image.ImageConsumer.setHints(int) definition code for java.awt.image.ImageConsumer.setHints(int) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
hints - a set of hints used to process the pixels

setProperties sample code for java.awt.image.PixelGrabber.setProperties(java.util.Hashtable<?, ?>) definition code for java.awt.image.PixelGrabber.setProperties(java.util.Hashtable<?, ?>)

public void setProperties(Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable <?,?> props)
The setProperties method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setProperties sample code for java.awt.image.ImageConsumer.setProperties(java.util.Hashtable) definition code for java.awt.image.ImageConsumer.setProperties(java.util.Hashtable) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
props - the list of properties

setColorModel sample code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel) definition code for java.awt.image.PixelGrabber.setColorModel(java.awt.image.ColorModel)

public void setColorModel(ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model)
The setColorModel method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setColorModel sample code for java.awt.image.ImageConsumer.setColorModel(java.awt.image.ColorModel) definition code for java.awt.image.ImageConsumer.setColorModel(java.awt.image.ColorModel) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
model - the specified ColorModel
See Also:
getColorModel() sample code for java.awt.image.PixelGrabber.getColorModel() definition code for java.awt.image.PixelGrabber.getColorModel()

setPixels sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int)

public void setPixels(int srcX,
                      int srcY,
                      int srcW,
                      int srcH,
                      ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model,
                      byte[] pixels,
                      int srcOff,
                      int srcScan)
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setPixels sample code for java.awt.image.ImageConsumer.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) definition code for java.awt.image.ImageConsumer.setPixels(int, int, int, int, java.awt.image.ColorModel, byte[], int, int) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
srcX, srcY - the coordinates of the upper-left corner of the area of pixels to be set
srcW - the width of the area of pixels
srcH - the height of the area of pixels
model - the specified ColorModel
pixels - the array of pixels
srcOff - the offset into the pixels array
srcScan - the distance from one row of pixels to the next in the pixels array
See Also:
getPixels() sample code for java.awt.image.PixelGrabber.getPixels() definition code for java.awt.image.PixelGrabber.getPixels()

setPixels sample code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) definition code for java.awt.image.PixelGrabber.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int)

public void setPixels(int srcX,
                      int srcY,
                      int srcW,
                      int srcH,
                      ColorModel sample code for java.awt.image.ColorModel definition code for java.awt.image.ColorModel  model,
                      int[] pixels,
                      int srcOff,
                      int srcScan)
The setPixels method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
setPixels sample code for java.awt.image.ImageConsumer.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) definition code for java.awt.image.ImageConsumer.setPixels(int, int, int, int, java.awt.image.ColorModel, int[], int, int) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
srcX, srcY - the coordinates of the upper-left corner of the area of pixels to be set
srcW - the width of the area of pixels
srcH - the height of the area of pixels
model - the specified ColorModel
pixels - the array of pixels
srcOff - the offset into the pixels array
srcScan - the distance from one row of pixels to the next in the pixels array
See Also:
getPixels() sample code for java.awt.image.PixelGrabber.getPixels() definition code for java.awt.image.PixelGrabber.getPixels()

imageComplete sample code for java.awt.image.PixelGrabber.imageComplete(int) definition code for java.awt.image.PixelGrabber.imageComplete(int)

public void imageComplete(int status)
The imageComplete method is part of the ImageConsumer API which this class must implement to retrieve the pixels.

Note: This method is intended to be called by the ImageProducer of the Image whose pixels are being grabbed. Developers using this class to retrieve pixels from an image should avoid calling this method directly since that operation could result in problems with retrieving the requested pixels.

Specified by:
imageComplete sample code for java.awt.image.ImageConsumer.imageComplete(int) definition code for java.awt.image.ImageConsumer.imageComplete(int) in interface ImageConsumer sample code for java.awt.image.ImageConsumer definition code for java.awt.image.ImageConsumer
Parameters:
status - the status of image loading
See Also:
ImageProducer.removeConsumer(java.awt.image.ImageConsumer) sample code for java.awt.image.ImageProducer.removeConsumer(java.awt.image.ImageConsumer) definition code for java.awt.image.ImageProducer.removeConsumer(java.awt.image.ImageConsumer)

status sample code for java.awt.image.PixelGrabber.status() definition code for java.awt.image.PixelGrabber.status()

public int status()
Returns the status of the pixels. The ImageObserver flags representing the available pixel information are returned. This method and getStatus sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus() have the same implementation, but getStatus is the preferred method because it conforms to the convention of naming information-retrieval methods with the form "getXXX".

Returns:
the bitwise OR of all relevant ImageObserver flags
See Also:
ImageObserver sample code for java.awt.image.ImageObserver definition code for java.awt.image.ImageObserver , getStatus() sample code for java.awt.image.PixelGrabber.getStatus() definition code for java.awt.image.PixelGrabber.getStatus()