captcha.graphics
Class RgbMemoryImageConsumer

java.lang.Object
  extended by captcha.graphics.RgbMemoryImageConsumer
All Implemented Interfaces:
java.awt.image.ImageConsumer

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

This class grabs the pixels of an image from an ImageProducer.


Field Summary
private  int m_height
          Stores the height of the produced image.
private  java.awt.image.ImageProducer m_imageProducer
          Stores the ImageProducer, which produces the image data.
private  boolean m_productionComplete
          Stores whether the image production is ready.
private  java.lang.Object m_productionLock
          This Object is needed for internal synchronization.
private  int[] m_rgbPixels
          Stores the pixels of the image in the RGB format.
private  int m_width
          Stores the width of the produced image.
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
RgbMemoryImageConsumer(java.awt.image.ImageProducer a_imageProducer)
          Creates a ne RgbMemoryImageConsumer.
 
Method Summary
 int getHeight()
          Returns the height of the produced image.
 int[] getRgbPixels()
          Returns a copy of the pixel data of the produced image in the default RGB color model.
 int getWidth()
          Returns the width of the produced image.
 void imageComplete(int a_status)
          This method is called by the ImageProducer, if the image production is ready.
 void setColorModel(java.awt.image.ColorModel a_colorModel)
          This method is only for compatibility with the ImageConsumer interface.
 void setDimensions(int a_width, int a_height)
          This method sets the dimensions of the produced image.
 void setHints(int a_hints)
          This method is only for compatibility with the ImageConsumer interface.
 void setPixels(int a_posX, int a_posY, int a_width, int a_height, java.awt.image.ColorModel a_colorModel, byte[] a_pixels, int a_offset, int a_scansize)
          This method transfers the pixels between ImageProducer and ImageConsumer.
 void setPixels(int a_posX, int a_posY, int a_width, int a_height, java.awt.image.ColorModel a_colorModel, int[] a_pixels, int a_offset, int a_scansize)
          This method transfers the pixels between ImageProducer and ImageConsumer.
 void setProperties(java.util.Hashtable a_properties)
          This method is only for compatibility with the ImageConsumer interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_rgbPixels

private int[] m_rgbPixels
Stores the pixels of the image in the RGB format.


m_imageProducer

private java.awt.image.ImageProducer m_imageProducer
Stores the ImageProducer, which produces the image data.


m_width

private int m_width
Stores the width of the produced image.


m_height

private int m_height
Stores the height of the produced image.


m_productionLock

private java.lang.Object m_productionLock
This Object is needed for internal synchronization.


m_productionComplete

private boolean m_productionComplete
Stores whether the image production is ready. This is needed for internal synchronization.

Constructor Detail

RgbMemoryImageConsumer

public RgbMemoryImageConsumer(java.awt.image.ImageProducer a_imageProducer)
Creates a ne RgbMemoryImageConsumer. This method blocks until the image is produced by the ImageProducer.

Parameters:
a_imageProducer - The ImageProducer which produces the image.
Method Detail

imageComplete

public void imageComplete(int a_status)
This method is called by the ImageProducer, if the image production is ready. Nobody else than the ImageProducer should call this method.

Specified by:
imageComplete in interface java.awt.image.ImageConsumer
Parameters:
a_status - The error code of the image production.

setColorModel

public void setColorModel(java.awt.image.ColorModel a_colorModel)
This method is only for compatibility with the ImageConsumer interface.

Specified by:
setColorModel in interface java.awt.image.ImageConsumer
Parameters:
a_colorModel - The default color model of the produced pixels.

setDimensions

public void setDimensions(int a_width,
                          int a_height)
This method sets the dimensions of the produced image. Only the ImageProducer should call this method.

Specified by:
setDimensions in interface java.awt.image.ImageConsumer
Parameters:
a_width - The width of the produced image.
a_height - The height of the produced image.

setHints

public void setHints(int a_hints)
This method is only for compatibility with the ImageConsumer interface.

Specified by:
setHints in interface java.awt.image.ImageConsumer
Parameters:
a_hints - Some hints about the pixel transfer between ImageProducer and ImageConsumer.

setPixels

public void setPixels(int a_posX,
                      int a_posY,
                      int a_width,
                      int a_height,
                      java.awt.image.ColorModel a_colorModel,
                      int[] a_pixels,
                      int a_offset,
                      int a_scansize)
This method transfers the pixels between ImageProducer and ImageConsumer. Only the ImageProducer should call this method.

Specified by:
setPixels in interface java.awt.image.ImageConsumer
Parameters:
a_posX - The X position of the transfer rectangle.
a_posY - The Y position of the transfer rectangle.
a_width - The width of the transfer rectangle.
a_height - The height of the transfer rectangle.
a_pixels - The pixel data of the transfer rectangle.
a_offset - The offset in the pixel data array.
a_scansize - The length of each line in the pixel data array.

setPixels

public void setPixels(int a_posX,
                      int a_posY,
                      int a_width,
                      int a_height,
                      java.awt.image.ColorModel a_colorModel,
                      byte[] a_pixels,
                      int a_offset,
                      int a_scansize)
This method transfers the pixels between ImageProducer and ImageConsumer. Only the ImageProducer should call this method.

Specified by:
setPixels in interface java.awt.image.ImageConsumer
Parameters:
a_posX - The X position of the transfer rectangle.
a_posY - The Y position of the transfer rectangle.
a_width - The width of the transfer rectangle.
a_height - The height of the transfer rectangle.
a_pixels - The pixel data of the transfer rectangle.
a_offset - The offset in the pixel data array.
a_scansize - The length of each line in the pixel data array.

setProperties

public void setProperties(java.util.Hashtable a_properties)
This method is only for compatibility with the ImageConsumer interface. ******* pre Java 5 *******

Specified by:
setProperties in interface java.awt.image.ImageConsumer
Parameters:
a_properties - Some properties for the produced image.

getWidth

public int getWidth()
Returns the width of the produced image.

Returns:
The width of the produced image.

getHeight

public int getHeight()
Returns the height of the produced image.

Returns:
The height of the produced image.

getRgbPixels

public int[] getRgbPixels()
Returns a copy of the pixel data of the produced image in the default RGB color model.

Returns:
The pixel data in the default RGB color model.