Package com.jhlabs.image
Class DiffusionFilter
- java.lang.Object
-
- com.jhlabs.image.AbstractBufferedImageOp
-
- com.jhlabs.image.WholeImageFilter
-
- com.jhlabs.image.DiffusionFilter
-
- All Implemented Interfaces:
java.awt.image.BufferedImageOp
,java.io.Serializable
,java.lang.Cloneable
public class DiffusionFilter extends WholeImageFilter
A filter which uses Floyd-Steinberg error diffusion dithering to halftone an image.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static int[]
diffusionMatrix
int
levels
-
Fields inherited from class com.jhlabs.image.WholeImageFilter
originalSpace, transformedSpace
-
-
Constructor Summary
Constructors Constructor Description DiffusionFilter()
Construct a DiffusionFilter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int[]
filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)
boolean
getColorDither()
int
getLevels()
int[]
getMatrix()
boolean
getSerpentine()
Return the serpentine settingvoid
setColorDither(boolean colorDither)
void
setLevels(int levels)
void
setMatrix(int[] matrix)
void
setSerpentine(boolean serpentine)
Set whether to use a serpentine pattern for return or not.java.lang.String
toString()
-
Methods inherited from class com.jhlabs.image.WholeImageFilter
filter, transformSpace
-
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB
-
-
-
-
Method Detail
-
setSerpentine
public void setSerpentine(boolean serpentine)
Set whether to use a serpentine pattern for return or not. This can reduce 'avalanche' artifacts in the output.- Parameters:
serpentine
- true to use serpentine pattern
-
getSerpentine
public boolean getSerpentine()
Return the serpentine setting- Returns:
- the current setting
-
setColorDither
public void setColorDither(boolean colorDither)
-
getColorDither
public boolean getColorDither()
-
setMatrix
public void setMatrix(int[] matrix)
-
getMatrix
public int[] getMatrix()
-
setLevels
public void setLevels(int levels)
-
getLevels
public int getLevels()
-
filterPixels
protected int[] filterPixels(int width, int height, int[] inPixels, java.awt.Rectangle transformedSpace)
- Specified by:
filterPixels
in classWholeImageFilter
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-