com.tensegrity.graphics.awt
Class AWTPixelGrabber

java.lang.Object
  extended bycom.tensegrity.graphics.awt.AWTPixelGrabber
All Implemented Interfaces:
java.awt.image.ImageConsumer

public class AWTPixelGrabber
extends java.lang.Object
implements java.awt.image.ImageConsumer

The AWTPixelGrabber class is used to transfer the pixels of a java.awt.Image into a com.tensegrity.graphics.image.Raster.

To do that the AWTPixelGrabber class implements the java.awt.image.ImageConsumer interface and uses the java.awt.image.ImageProducer interface to receive the pixels.
To get more informations about these interfaces and the mechanism they are associated with please take a look at the documentation of ImageConsumer and/or ImageProducer.

Version:
$Id: AWTPixelGrabber.java,v 1.7 2005/07/18 15:13:43 BurkhardWick Exp $
Author:
MichaelKegel

Field Summary
 int ABORT
          constant that tells about one of the states of the AWTPixelGrabber
 int ERROR
          constant that tells about one of the states of the AWTPixelGrabber
 int GRAB_CX
          constant that tells about one of the states of the AWTPixelGrabber
 int GRAB_CY
          constant that tells about one of the states of the AWTPixelGrabber
 int GRABBING
          constant that tells about one of the states of the AWTPixelGrabber
 int INACTIVE
          constant that tells about one of the states of the AWTPixelGrabber
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
AWTPixelGrabber(java.awt.image.ImageProducer producer, Raster raster)
          Constructor that creates a AWTPixelGrabber for the ImageProducer given by producer.
 
Method Summary
 int getState()
          Returns a constant that tells about the current state of the AWTPixelGrabber.
 void grab()
          Starts the grabbing process.
 void grab(long millis)
          Starts the grabbing process with respect to the timeout given by millis.
 void imageComplete(int status)
           
 boolean isValid()
          Returns a boolean that indicates whether the last grabbing process was successful or not.
 void setColorModel(java.awt.image.ColorModel model)
           
 void setDimensions(int width, int height)
           
 void setHints(int hintflags)
           
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, byte[] pixels, int off, int scansize)
           
 void setPixels(int x, int y, int w, int h, java.awt.image.ColorModel model, int[] pixels, int off, int scansize)
           
 void setProperties(java.util.Hashtable props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INACTIVE

public final int INACTIVE
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values

ERROR

public final int ERROR
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values

ABORT

public final int ABORT
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values

GRABBING

public final int GRABBING
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values

GRAB_CX

public final int GRAB_CX
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values

GRAB_CY

public final int GRAB_CY
constant that tells about one of the states of the AWTPixelGrabber

See Also:
Constant Field Values
Constructor Detail

AWTPixelGrabber

public AWTPixelGrabber(java.awt.image.ImageProducer producer,
                       Raster raster)
Constructor that creates a AWTPixelGrabber for the ImageProducer given by producer. The grabbed pixels are written to the Raster given by raster.

Parameters:
producer - the ImageProducer to grab the pixels from
raster - the Raster to write the grabbed pixels to
Method Detail

getState

public int getState()
Returns a constant that tells about the current state of the AWTPixelGrabber. The returned constants are listed below:

Returns:
int constant that tells about the current state

isValid

public boolean isValid()
Returns a boolean that indicates whether the last grabbing process was successful or not.

Returns:
boolean flag that indicates whether the last grabbing was successful

grab

public void grab()
Starts the grabbing process.


grab

public void grab(long millis)
Starts the grabbing process with respect to the timeout given by millis. If the timeout value has been passed over the grabbing process is aborted.

Parameters:
millis - the timeout value in milliseconds

setDimensions

public void setDimensions(int width,
                          int height)
Specified by:
setDimensions in interface java.awt.image.ImageConsumer

setProperties

public void setProperties(java.util.Hashtable props)
Specified by:
setProperties in interface java.awt.image.ImageConsumer

setColorModel

public void setColorModel(java.awt.image.ColorModel model)
Specified by:
setColorModel in interface java.awt.image.ImageConsumer

setHints

public void setHints(int hintflags)
Specified by:
setHints in interface java.awt.image.ImageConsumer

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      byte[] pixels,
                      int off,
                      int scansize)
Specified by:
setPixels in interface java.awt.image.ImageConsumer

setPixels

public void setPixels(int x,
                      int y,
                      int w,
                      int h,
                      java.awt.image.ColorModel model,
                      int[] pixels,
                      int off,
                      int scansize)
Specified by:
setPixels in interface java.awt.image.ImageConsumer

imageComplete

public void imageComplete(int status)
Specified by:
imageComplete in interface java.awt.image.ImageConsumer


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.