java.awt.image

Class LookupOp

public class LookupOp extends Object implements BufferedImageOp, RasterOp

LookupOp is a filter that converts each pixel using a lookup table. For filtering Rasters, the lookup table must have either one component that is applied to all bands, or one component for every band in the Rasters. For BufferedImages, the lookup table may apply to both color and alpha components. If the lookup table contains one component, or if there are the same number of components as color components in the source, the table applies to all color components. Otherwise the table applies to all components including alpha. Alpha premultiplication is ignored during the lookup filtering. After filtering, if color conversion is necessary, the conversion happens, taking alpha premultiplication into account.
Constructor Summary
LookupOp(LookupTable lookup, RenderingHints hints)
Construct a new LookupOp using the given LookupTable.
Method Summary
BufferedImagecreateCompatibleDestImage(BufferedImage src, ColorModel dstCM)
WritableRastercreateCompatibleDestRaster(Raster src)
BufferedImagefilter(BufferedImage src, BufferedImage dst)
Converts the source image using the lookup table specified in the constructor.
WritableRasterfilter(Raster src, WritableRaster dest)
Filter a raster through a lookup table.
Rectangle2DgetBounds2D(BufferedImage src)
Rectangle2DgetBounds2D(Raster src)
Point2DgetPoint2D(Point2D src, Point2D dst)
Returns the corresponding destination point for a given source point.
RenderingHintsgetRenderingHints()
LookupTablegetTable()
Return the LookupTable for this op.

Constructor Detail

LookupOp

public LookupOp(LookupTable lookup, RenderingHints hints)
Construct a new LookupOp using the given LookupTable.

Parameters: lookup LookupTable to use. hints Rendering hints (can be null).

Method Detail

createCompatibleDestImage

public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM)

createCompatibleDestRaster

public WritableRaster createCompatibleDestRaster(Raster src)

filter

public final BufferedImage filter(BufferedImage src, BufferedImage dst)
Converts the source image using the lookup table specified in the constructor. The resulting image is stored in the destination image if one is provided; otherwise a new BufferedImage is created and returned. The source image cannot use an IndexColorModel, and the destination image (if one is provided) must have the same size.

Parameters: src The source image. dst The destination image.

Returns: The convolved image.

Throws: IllegalArgumentException if the rasters and/or color spaces are incompatible. ArrayIndexOutOfBoundsException if a pixel in the source is not contained in the LookupTable.

filter

public final WritableRaster filter(Raster src, WritableRaster dest)
Filter a raster through a lookup table. Applies the lookup table for this Rasterop to each pixel of src and puts the results in dest. If dest is null, a new Raster is created and returned.

Parameters: src The source raster. dest The destination raster.

Returns: The WritableRaster with the filtered pixels.

Throws: IllegalArgumentException if lookup table has more than one component but not the same as src and dest. ArrayIndexOutOfBoundsException if a pixel in the source is not contained in the LookupTable.

getBounds2D

public final Rectangle2D getBounds2D(BufferedImage src)

getBounds2D

public final Rectangle2D getBounds2D(Raster src)

getPoint2D

public final Point2D getPoint2D(Point2D src, Point2D dst)
Returns the corresponding destination point for a given source point. This Op will return the source point unchanged.

Parameters: src The source point. dst The destination point.

getRenderingHints

public final RenderingHints getRenderingHints()

getTable

public final LookupTable getTable()
Return the LookupTable for this op.

Returns: The lookup table.