com.ngs.image.filter
Class BrightnessContrastOp

java.lang.Object
  extended by com.ngs.image.filter.BrightnessContrastOp
All Implemented Interfaces:
BufferedImageOp, RasterOp

public class BrightnessContrastOp
extends Object
implements BufferedImageOp, RasterOp

Java-Only implementation that handles Brightness, Contrast, and Invert via lookup-table manipulation of ColorModels. This is included for completness, and is probably most beneficial to those individuals looking to learn about lower-level Image handling & manipulation.

This class is unused by the core Shimaging ImagePanel, but may be usefull in some cases. Shimaging uses RescaleOp & LookupOp to implement it's contrast, brightness, and invert operations. These J2SE standard filters are often accelerated by ImageLib native implementations.


Constructor Summary
BrightnessContrastOp(int brightness, float contrast, RenderingHints hints)
          Creates a new Brightness & Contrast Operation with the given brightness, contrast, and rendering hints.
BrightnessContrastOp(RenderingHints hints)
          Creates a new Brightness & Contrast Operation.
 
Method Summary
 BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel destCM)
           
 WritableRaster createCompatibleDestRaster(Raster src)
           
 BufferedImage filter(BufferedImage src, BufferedImage dst)
           
 WritableRaster filter(Raster src, WritableRaster dst)
           
 Rectangle2D getBounds2D(BufferedImage src)
           
 Rectangle2D getBounds2D(Raster src)
           
 int getBrightness()
           
 float getContrast()
           
 boolean getInvert()
           
 Point2D getPoint2D(Point2D srcPt, Point2D dstPt)
           
 RenderingHints getRenderingHints()
           
 void setBrightness(int brightness)
          Sets the brightness used when filtering.
 void setContrast(float contrast)
          Sets the contrast used when filtering.
 void setInvert(boolean invert)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrightnessContrastOp

public BrightnessContrastOp(RenderingHints hints)
Creates a new Brightness & Contrast Operation.


BrightnessContrastOp

public BrightnessContrastOp(int brightness,
                            float contrast,
                            RenderingHints hints)
Creates a new Brightness & Contrast Operation with the given brightness, contrast, and rendering hints.

Method Detail

setBrightness

public void setBrightness(int brightness)
Sets the brightness used when filtering.


setContrast

public void setContrast(float contrast)
Sets the contrast used when filtering.


getBrightness

public int getBrightness()

getContrast

public float getContrast()

getInvert

public boolean getInvert()

setInvert

public void setInvert(boolean invert)

createCompatibleDestImage

public BufferedImage createCompatibleDestImage(BufferedImage src,
                                               ColorModel destCM)
Specified by:
createCompatibleDestImage in interface BufferedImageOp

createCompatibleDestRaster

public WritableRaster createCompatibleDestRaster(Raster src)
Specified by:
createCompatibleDestRaster in interface RasterOp

getBounds2D

public Rectangle2D getBounds2D(BufferedImage src)
Specified by:
getBounds2D in interface BufferedImageOp

getBounds2D

public Rectangle2D getBounds2D(Raster src)
Specified by:
getBounds2D in interface RasterOp

getPoint2D

public Point2D getPoint2D(Point2D srcPt,
                          Point2D dstPt)
Specified by:
getPoint2D in interface BufferedImageOp
Specified by:
getPoint2D in interface RasterOp

getRenderingHints

public RenderingHints getRenderingHints()
Specified by:
getRenderingHints in interface BufferedImageOp
Specified by:
getRenderingHints in interface RasterOp

filter

public BufferedImage filter(BufferedImage src,
                            BufferedImage dst)
Specified by:
filter in interface BufferedImageOp

filter

public WritableRaster filter(Raster src,
                             WritableRaster dst)
Specified by:
filter in interface RasterOp