j2d
Class ImageProcessor

java.lang.Object
  extended by j2d.ImageProcessor
All Implemented Interfaces:
java.awt.image.ImageObserver
Direct Known Subclasses:
ColorMapGenerator, ColorMapGenerator, ColorMapGenerator, ExponentialStretchProcessor, FalseColorProcessor, HistogramEQProcessor, LinearMappingProcessor

public abstract class ImageProcessor
extends java.lang.Object
implements java.awt.image.ImageObserver

This class will be the basis of many image processing algorithms. All image processing algorithms operate on an image and require the image's height and width. This class encapsulates that functionality. Also, all image processing operations will require a performAlgorithm() method. This method is left as abstract.


Field Summary
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ImageProcessor()
          Construct a new ImageProcessor.
 
Method Summary
 java.awt.Image getBaseImage()
          Return a handle to the base image.
 int getBaseImageHeight()
          Obtain the height of the base image.
 int getBaseImageWidth()
          Obtain the width of the base image.
 int[] getPixels()
          Return newImage converted to an array of pixels.
 java.awt.Image getProcessedImage()
          Return a handle to the processed image.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          Implementation of ImageObserver.
 void openImage(java.io.File file)
          Set the base image reference to an image object read from the specified file.
abstract  void processImage()
          This abstract function must be overridden by any actual ImageProcessor implementation.
 void setBaseImage(java.awt.Image newImage)
          Set the base image reference.
 void setPixels(int[] pixels)
          Store the array of pixels into newImage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageProcessor

public ImageProcessor()
Construct a new ImageProcessor.

Method Detail

openImage

public void openImage(java.io.File file)
Set the base image reference to an image object read from the specified file.


setBaseImage

public void setBaseImage(java.awt.Image newImage)
Set the base image reference.


getBaseImage

public java.awt.Image getBaseImage()
Return a handle to the base image.


getBaseImageWidth

public int getBaseImageWidth()
Obtain the width of the base image.


getBaseImageHeight

public int getBaseImageHeight()
Obtain the height of the base image.


getProcessedImage

public java.awt.Image getProcessedImage()
Return a handle to the processed image.


getPixels

public int[] getPixels()
Return newImage converted to an array of pixels.


setPixels

public void setPixels(int[] pixels)
Store the array of pixels into newImage


imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Implementation of ImageObserver. This is used in case the image takes some time to load and the width and height are not immediately available.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver

processImage

public abstract void processImage()
                           throws java.lang.Exception
This abstract function must be overridden by any actual ImageProcessor implementation. This is where the real image processing happens. If the implementation generates an output image, performAlgorithm is responsible for updating newImage.

Throws:
java.lang.Exception