Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.awt.image

Class PixelGrabber

java.lang.Object
|
+--java.awt.image.PixelGrabber

All Implemented Interfaces:

ImageConsumer


public class PixelGrabber

extends Object

implements ImageConsumer

PixelGrabber is an ImageConsumer designed to extract a rectangular region of pixels from an Image

Constructor Summary

PixelGrabber(java.awt.Image img, int x, int y, int w, int h, int[] pix, int off, int scansize)

Create a PixelGrabber used to grab pixels from the specified Image in the specified rectangle
PixelGrabber(java.awt.image.ImageProducer ip, int x, int y, int w, int h, int[] pix, int off, int scansize)

Create a PixelGrabber used to grab pixels from the specified ImageProducer in the specified rectangle
PixelGrabber(java.awt.Image img, int x, int y, int w, int h, boolean forceRGB)

Create a PixelGrabber used to grab pixels from the specified Image in the specified rectangle

Method Summary

synchronized voidabortGrabbing()

Abort the grabbing of pixels
synchronized java.awt.image.ColorModelgetColorModel()

Get the ColorModel of the image
synchronized intgetHeight()

Return height of pixel region
synchronized java.lang.ObjectgetPixels()

Returns the grabbed pixel buffer
synchronized intgetStatus()

Get the status of the pixel grabbing representing by ImageObserver flags
synchronized intgetWidth()

Return width of pixel region
booleangrabPixels()

Grab the Pixels.
synchronized booleangrabPixels(long ms)

Grab the Pixels and abort if it takes too long
synchronized voidimageComplete(int status)

The ImageProducer calls this method to indicate a single frame or the entire image is complete.
voidsetColorModel(java.awt.image.ColorModel model)

This ColorModel should indicate the model used by the majority of calls to setPixels.
voidsetDimensions(int width, int height)

An ImageProducer indicates the size of the image being produced using this method.
voidsetHints(int flags)

The ImageProducer should call this method with a bit mask of hints from any of RANDOMPIXELORDER, TOPDOWNLEFTRIGHT, COMPLETESCANLINES, SINGLEPASS, SINGLEFRAME.
voidsetPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int offset, int scansize)

This function delivers a rectangle of pixels where any pixel(m,n) is stored in the array as a byte at index (n * scansize + m + offset).
voidsetPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int offset, int scansize)

This function delivers a rectangle of pixels where any pixel(m,n) is stored in the array as an int at index (n * scansize + m + offset).
voidsetProperties(java.util.Hashtable props)

An ImageProducer can set a list of properties associated with this image by using this method.
synchronized voidstartGrabbing()

Start Grabbing Pixels
synchronized intstatus()

Constructor Details

PixelGrabber

public PixelGrabber(java.awt.Image img, int x, int y, int w, int h, boolean forceRGB)

Create a PixelGrabber used to grab pixels from the specified Image in the specified rectangle

Parameters:


PixelGrabber

public PixelGrabber(java.awt.Image img, int x, int y, int w, int h, int[] pix, int off, int scansize)

Create a PixelGrabber used to grab pixels from the specified Image in the specified rectangle

Parameters:


PixelGrabber

public PixelGrabber(java.awt.image.ImageProducer ip, int x, int y, int w, int h, int[] pix, int off, int scansize)

Create a PixelGrabber used to grab pixels from the specified ImageProducer in the specified rectangle

Parameters:


Method Details

abortGrabbing

public synchronized void abortGrabbing()

Abort the grabbing of pixels


getColorModel

public synchronized ColorModel getColorModel()

Get the ColorModel of the image

Returns:


getHeight

public synchronized int getHeight()

Return height of pixel region

Returns:


getPixels

public synchronized Object getPixels()

Returns the grabbed pixel buffer

Returns:


getStatus

public synchronized int getStatus()

Get the status of the pixel grabbing representing by ImageObserver flags

Returns:


getWidth

public synchronized int getWidth()

Return width of pixel region

Returns:


grabPixels

public boolean grabPixels()

Grab the Pixels.

Returns:

Throws:


grabPixels

public synchronized boolean grabPixels(long ms)

Grab the Pixels and abort if it takes too long

Parameters:

Returns:

Throws:


imageComplete

public synchronized void imageComplete(int status)

The ImageProducer calls this method to indicate a single frame or the entire image is complete. The method is also used to indicate an error in loading or producing the image.

Parameters:


setColorModel

public void setColorModel(java.awt.image.ColorModel model)

This ColorModel should indicate the model used by the majority of calls to setPixels. Each call to setPixels could however indicate a different ColorModel.

Parameters:

See Also:


setDimensions

public void setDimensions(int width, int height)

An ImageProducer indicates the size of the image being produced using this method.

Parameters:


setHints

public void setHints(int flags)

The ImageProducer should call this method with a bit mask of hints from any of RANDOMPIXELORDER, TOPDOWNLEFTRIGHT, COMPLETESCANLINES, SINGLEPASS, SINGLEFRAME.

Parameters:


setPixels

public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int offset, int scansize)

This function delivers a rectangle of pixels where any pixel(m,n) is stored in the array as a byte at index (n * scansize + m + offset).

Parameters:


setPixels

public void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int offset, int scansize)

This function delivers a rectangle of pixels where any pixel(m,n) is stored in the array as an int at index (n * scansize + m + offset).

Parameters:


setProperties

public void setProperties(java.util.Hashtable props)

An ImageProducer can set a list of properties associated with this image by using this method.

Parameters:


startGrabbing

public synchronized void startGrabbing()

Start Grabbing Pixels


status

public synchronized int status()