Package com.jhlabs.image
Class DitherFilter
java.lang.Object
com.jhlabs.image.AbstractBufferedImageOp
com.jhlabs.image.PointFilter
com.jhlabs.image.DitherFilter
- All Implemented Interfaces:
BufferedImageOp
,Cloneable
A filter which performs ordered dithering on an image.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int[]
6x6 90 degree halftone.static final int[]
Order-3 clustered dither.static final int[]
Order-4 clustered dither.static final int[]
Order-8 clustered dither.static final int[]
4x4 lines.protected static final int[]
2x2 magic square.protected static final int[]
4x4 magic square.static final int[]
4x4 ordered dither.static final int[]
Order-6 ordered dither.static final int[]
Order-8 ordered dither.Fields inherited from class com.jhlabs.image.PointFilter
canFilterIndexColorModel
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
filterRGB
(int x, int y, int rgb) int
Get the number of dither levels.int[]
Get the dither matrix.protected void
Initialize the filter.void
setLevels
(int levels) Set the number of dither levels.void
setMatrix
(int[] matrix) Set the dither matrix.toString()
Methods inherited from class com.jhlabs.image.PointFilter
filter, setDimensions
Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp
clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints, getRGB, setRGB
-
Field Details
-
ditherMagic2x2Matrix
protected static final int[] ditherMagic2x2Matrix2x2 magic square. -
ditherMagic4x4Matrix
protected static final int[] ditherMagic4x4Matrix4x4 magic square. -
ditherOrdered4x4Matrix
public static final int[] ditherOrdered4x4Matrix4x4 ordered dither. -
ditherLines4x4Matrix
public static final int[] ditherLines4x4Matrix4x4 lines. -
dither90Halftone6x6Matrix
public static final int[] dither90Halftone6x6Matrix6x6 90 degree halftone. -
ditherOrdered6x6Matrix
public static final int[] ditherOrdered6x6MatrixOrder-6 ordered dither. -
ditherOrdered8x8Matrix
public static final int[] ditherOrdered8x8MatrixOrder-8 ordered dither. -
ditherCluster3Matrix
public static final int[] ditherCluster3MatrixOrder-3 clustered dither. -
ditherCluster4Matrix
public static final int[] ditherCluster4MatrixOrder-4 clustered dither. -
ditherCluster8Matrix
public static final int[] ditherCluster8MatrixOrder-8 clustered dither.
-
-
Constructor Details
-
DitherFilter
public DitherFilter()Constuct a DitherFilter.
-
-
Method Details
-
setMatrix
public void setMatrix(int[] matrix) Set the dither matrix.- Parameters:
matrix
- the dither matrix- See Also:
-
getMatrix
public int[] getMatrix()Get the dither matrix.- Returns:
- the dither matrix
- See Also:
-
setLevels
public void setLevels(int levels) Set the number of dither levels.- Parameters:
levels
- the number of levels- See Also:
-
getLevels
public int getLevels()Get the number of dither levels.- Returns:
- the number of levels
- See Also:
-
initialize
protected void initialize()Initialize the filter. -
filterRGB
public int filterRGB(int x, int y, int rgb) - Specified by:
filterRGB
in classPointFilter
-
toString
-