org.jvnet.substance.utils.filters
Class AbstractFilter

java.lang.Object
  extended by org.jvnet.substance.utils.filters.AbstractFilter
All Implemented Interfaces:
java.awt.image.BufferedImageOp
Direct Known Subclasses:
ColorSchemeFilter, GrayscaleFilter, NegatedFilter, TranslucentFilter

public abstract class AbstractFilter
extends java.lang.Object
implements java.awt.image.BufferedImageOp

Provides an abstract implementation of the BufferedImageOp interface. This class can be used to created new image filters based on BufferedImageOp.

Author:
Romain Guy

Constructor Summary
AbstractFilter()
           
 
Method Summary
 java.awt.image.BufferedImage createCompatibleDestImage(java.awt.image.BufferedImage src, java.awt.image.ColorModel destCM)
          
abstract  java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
           
 java.awt.geom.Rectangle2D getBounds2D(java.awt.image.BufferedImage src)
          
protected  int[] getPixels(java.awt.image.BufferedImage img, int x, int y, int w, int h, int[] pixels)
           
 java.awt.geom.Point2D getPoint2D(java.awt.geom.Point2D srcPt, java.awt.geom.Point2D dstPt)
          
 java.awt.RenderingHints getRenderingHints()
          
protected  void setPixels(java.awt.image.BufferedImage img, int x, int y, int w, int h, int[] pixels)
           Writes a rectangular area of pixels in the destination BufferedImage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

filter

public abstract java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src,
                                                    java.awt.image.BufferedImage dest)
Specified by:
filter in interface java.awt.image.BufferedImageOp

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D(java.awt.image.BufferedImage src)

Specified by:
getBounds2D in interface java.awt.image.BufferedImageOp

createCompatibleDestImage

public java.awt.image.BufferedImage createCompatibleDestImage(java.awt.image.BufferedImage src,
                                                              java.awt.image.ColorModel destCM)

Specified by:
createCompatibleDestImage in interface java.awt.image.BufferedImageOp

getPoint2D

public java.awt.geom.Point2D getPoint2D(java.awt.geom.Point2D srcPt,
                                        java.awt.geom.Point2D dstPt)

Specified by:
getPoint2D in interface java.awt.image.BufferedImageOp

getRenderingHints

public java.awt.RenderingHints getRenderingHints()

Specified by:
getRenderingHints in interface java.awt.image.BufferedImageOp

getPixels

protected int[] getPixels(java.awt.image.BufferedImage img,
                          int x,
                          int y,
                          int w,
                          int h,
                          int[] pixels)

setPixels

protected void setPixels(java.awt.image.BufferedImage img,
                         int x,
                         int y,
                         int w,
                         int h,
                         int[] pixels)

Writes a rectangular area of pixels in the destination BufferedImage. Calling this method on an image of type different from BufferedImage.TYPE_INT_ARGB and BufferedImage.TYPE_INT_RGB will unmanage the image.

Parameters:
img - the destination image
x - the x location at which to start storing pixels
y - the y location at which to start storing pixels
w - the width of the rectangle of pixels to store
h - the height of the rectangle of pixels to store
pixels - an array of pixels, stored as integers
Throws:
java.lang.IllegalArgumentException - is pixels is non-null and of length < w*h