BufferedImageOp, RasterOppublic class DiffusionDither extends Object implements BufferedImageOp, RasterOp
BufferedImageOp/RasterOp implements basic
Floyd-Steinberg error-diffusion algorithm for dithering.
The weights used are 7/16, 3/16, 5/16 and 1/16, distributed like this:
| X | 7/16 | |
| 3/16 | 5/16 | 1/16 |
| Modifier and Type | Field | Description |
|---|---|---|
protected IndexColorModel |
indexColorModel |
| Constructor | Description |
|---|---|
DiffusionDither() |
Creates a
DiffusionDither, with no fixed
IndexColorModel. |
DiffusionDither(IndexColorModel pICM) |
Creates a
DiffusionDither, using the given
IndexColorModel for dithering into. |
| Modifier and Type | Method | Description |
|---|---|---|
BufferedImage |
createCompatibleDestImage(BufferedImage pSource,
ColorModel pDestCM) |
Creates a compatible
BufferedImage to dither into. |
WritableRaster |
createCompatibleDestRaster(Raster pSrc) |
Creates a compatible
Raster to dither into. |
WritableRaster |
createCompatibleDestRaster(Raster pSrc,
IndexColorModel pIndexColorModel) |
Creates a compatible
Raster to dither into. |
BufferedImage |
filter(BufferedImage pSource,
BufferedImage pDest) |
Performs a single-input/single-output dither operation, applying basic
Floyd-Steinberg error-diffusion to the image.
|
WritableRaster |
filter(Raster pSource,
WritableRaster pDest) |
Performs a single-input/single-output dither operation, applying basic
Floyd-Steinberg error-diffusion to the image.
|
WritableRaster |
filter(Raster pSource,
WritableRaster pDest,
IndexColorModel pColorModel) |
Performs a single-input/single-output dither operation, applying basic
Floyd-Steinberg error-diffusion to the image.
|
Rectangle2D |
getBounds2D(BufferedImage pSrc) |
Returns the bounding box of the filtered destination image.
|
Rectangle2D |
getBounds2D(Raster pSrc) |
Returns the bounding box of the filtered destination Raster.
|
Point2D |
getPoint2D(Point2D pSrcPt,
Point2D pDstPt) |
Returns the location of the destination point given a
point in the source.
|
RenderingHints |
getRenderingHints() |
Returns the rendering mHints for this op.
|
void |
setAlternateScans(boolean pUse) |
Sets the scan mode.
|
protected final IndexColorModel indexColorModel
public DiffusionDither(IndexColorModel pICM)
DiffusionDither, using the given
IndexColorModel for dithering into.pICM - an IndexColorModel.public DiffusionDither()
DiffusionDither, with no fixed
IndexColorModel. The color model will be generated for each
filtering, unless the destination image already has an
IndexColorModel.public void setAlternateScans(boolean pUse)
true.pUse - true if scan mode should be alternating left/rightpublic final BufferedImage createCompatibleDestImage(BufferedImage pSource, ColorModel pDestCM)
BufferedImage to dither into.
Only IndexColorModel allowed.createCompatibleDestImage in interface BufferedImageOpBufferedImageImageFilterException - if pDestCM is not null or
an instance of IndexColorModel.public final WritableRaster createCompatibleDestRaster(Raster pSrc)
Raster to dither into.
Only IndexColorModel allowed.createCompatibleDestRaster in interface RasterOppSrc - the source rasterWritableRasterpublic final WritableRaster createCompatibleDestRaster(Raster pSrc, IndexColorModel pIndexColorModel)
Raster to dither into.pSrc - the source raster.pIndexColorModel - the index color model used to create a Raster.WritableRasterpublic final Rectangle2D getBounds2D(BufferedImage pSrc)
getBounds2D in interface BufferedImageOppSrc - the BufferedImage to be filteredpublic final Rectangle2D getBounds2D(Raster pSrc)
getBounds2D in interface RasterOppSrc - the Raster to be filteredRaster.public final Point2D getPoint2D(Point2D pSrcPt, Point2D pDstPt)
dstPt is not
null, it will be used to hold the return value.
Since this is not a geometric operation, the srcPt
will equal the dstPt.getPoint2D in interface BufferedImageOpgetPoint2D in interface RasterOppSrcPt - a Point2D that represents a point
in the source imagepDstPt - a Point2Dthat represents the location
in the destinationPoint2D in the destination that
corresponds to the specified point in the source.public final RenderingHints getRenderingHints()
getRenderingHints in interface BufferedImageOpgetRenderingHints in interface RasterOpRenderingHints object associated
with this op.public final BufferedImage filter(BufferedImage pSource, BufferedImage pDest)
filter in interface BufferedImageOppSource - the source imagepDest - the destination imagepDest was
null.public final WritableRaster filter(Raster pSource, WritableRaster pDest)
public final WritableRaster filter(Raster pSource, WritableRaster pDest, IndexColorModel pColorModel)
pSource - the source raster, assumed to be in sRGBpDest - the destination raster, may be nullpColorModel - the indexed color model to usepDest was
null.Copyright © 2018. All rights reserved.