Package com.twelvemonkeys.image
Class CopyDither
java.lang.Object
com.twelvemonkeys.image.CopyDither
- All Implemented Interfaces:
BufferedImageOp
,RasterOp
This BufferedImageOp simply copies pixels, converting to a
IndexColorModel
.- Version:
- $Id: //depot/branches/personal/haraldk/twelvemonkeys/release-2/twelvemonkeys-core/src/main/java/com/twelvemonkeys/image/CopyDither.java#1 $
- Author:
- Harald Kuhr, last modified by $Author: haku $
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates aCopyDither
, with no fixedIndexColorModel
.CopyDither
(IndexColorModel pICM) Creates aCopyDither
, using the givenIndexColorModel
for dithering into. -
Method Summary
Modifier and TypeMethodDescriptionfinal BufferedImage
createCompatibleDestImage
(BufferedImage pSource, ColorModel pDestCM) Creates a compatibleBufferedImage
to dither into.final WritableRaster
Creates a compatibleRaster
to dither into.final WritableRaster
createCompatibleDestRaster
(Raster pSrc, IndexColorModel pIndexColorModel) final BufferedImage
filter
(BufferedImage pSource, BufferedImage pDest) Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image.final WritableRaster
filter
(Raster pSource, WritableRaster pDest) Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image.final WritableRaster
filter
(Raster pSource, WritableRaster pDest, IndexColorModel pColorModel) Performs a single-input/single-output pixel copy operation.final Rectangle2D
getBounds2D
(BufferedImage pSrc) Returns the bounding box of the filtered destination image.final Rectangle2D
getBounds2D
(Raster pSrc) Returns the bounding box of the filtered destination Raster.final Point2D
getPoint2D
(Point2D pSrcPt, Point2D pDstPt) Returns the location of the destination point given a point in the source.final RenderingHints
Returns the rendering mHints for this op.
-
Field Details
-
indexColorModel
-
-
Constructor Details
-
CopyDither
Creates aCopyDither
, using the givenIndexColorModel
for dithering into.- Parameters:
pICM
- an IndexColorModel.
-
CopyDither
public CopyDither()Creates aCopyDither
, with no fixedIndexColorModel
. The colormodel will be generated for each filtering, unless the dest image allready has anIndexColorModel
.
-
-
Method Details
-
createCompatibleDestImage
Creates a compatibleBufferedImage
to dither into. OnlyIndexColorModel
allowed.- Specified by:
createCompatibleDestImage
in interfaceBufferedImageOp
- Returns:
- a compatible
BufferedImage
- Throws:
ImageFilterException
- ifpDestCM
is notnull
or an instance ofIndexColorModel
.
-
createCompatibleDestRaster
Creates a compatibleRaster
to dither into. OnlyIndexColorModel
allowed.- Specified by:
createCompatibleDestRaster
in interfaceRasterOp
- Parameters:
pSrc
-- Returns:
- a
WritableRaster
-
createCompatibleDestRaster
public final WritableRaster createCompatibleDestRaster(Raster pSrc, IndexColorModel pIndexColorModel) -
getBounds2D
Returns the bounding box of the filtered destination image. Since this is not a geometric operation, the bounding box does not change.- Specified by:
getBounds2D
in interfaceBufferedImageOp
- Parameters:
pSrc
- theBufferedImage
to be filtered- Returns:
- the bounds of the filtered definition image.
-
getBounds2D
Returns the bounding box of the filtered destination Raster. Since this is not a geometric operation, the bounding box does not change.- Specified by:
getBounds2D
in interfaceRasterOp
- Parameters:
pSrc
- theRaster
to be filtered- Returns:
- the bounds of the filtered definition
Raster
.
-
getPoint2D
Returns the location of the destination point given a point in the source. IfdstPt
is notnull
, it will be used to hold the return value. Since this is not a geometric operation, thesrcPt
will equal thedstPt
.- Specified by:
getPoint2D
in interfaceBufferedImageOp
- Specified by:
getPoint2D
in interfaceRasterOp
- Parameters:
pSrcPt
- aPoint2D
that represents a point in the source imagepDstPt
- aPoint2D
that represents the location in the destination- Returns:
- the
Point2D
in the destination that corresponds to the specified point in the source.
-
getRenderingHints
Returns the rendering mHints for this op.- Specified by:
getRenderingHints
in interfaceBufferedImageOp
- Specified by:
getRenderingHints
in interfaceRasterOp
- Returns:
- the
RenderingHints
object associated with this op.
-
filter
Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image.- Specified by:
filter
in interfaceBufferedImageOp
- Parameters:
pSource
- the source imagepDest
- the destiantion image- Returns:
- the destination image, or a new image, if
pDest
wasnull
.
-
filter
Performs a single-input/single-output dither operation, applying basic Floyd-Steinberg error-diffusion to the image. -
filter
public final WritableRaster filter(Raster pSource, WritableRaster pDest, IndexColorModel pColorModel) Performs a single-input/single-output pixel copy operation.- Parameters:
pSource
-pDest
-pColorModel
-- Returns:
- the destination raster, or a new raster, if
pDest
wasnull
.
-