com.jhlabs.image

Class DitherFilter

Implemented Interfaces:
BufferedImageOp, Cloneable

public class DitherFilter
extends PointFilter

A filter which performs ordered dithering on an image.

Field Summary

static int[]
dither90Halftone6x6Matrix
6x6 90 degree halftone.
static int[]
ditherCluster3Matrix
Order-3 clustered dither.
static int[]
ditherCluster4Matrix
Order-4 clustered dither.
static int[]
ditherCluster8Matrix
Order-8 clustered dither.
static int[]
ditherLines4x4Matrix
4x4 lines.
protected static int[]
ditherMagic2x2Matrix
2x2 magic square.
protected static int[]
ditherMagic4x4Matrix
4x4 magic square.
static int[]
ditherOrdered4x4Matrix
4x4 ordered dither.
static int[]
ditherOrdered6x6Matrix
Order-6 ordered dither.
static int[]
ditherOrdered8x8Matrix
Order-8 ordered dither.

Fields inherited from class com.jhlabs.image.PointFilter

canFilterIndexColorModel

Constructor Summary

DitherFilter()
Constuct a DitherFilter.

Method Summary

int
filterRGB(int x, int y, int rgb)
int
getLevels()
Get the number of dither levels.
int[]
getMatrix()
Get the dither matrix.
protected void
initialize()
Initialize the filter.
void
setLevels(int levels)
Set the number of dither levels.
void
setMatrix(int[] matrix)
Set the dither matrix.
String
toString()

Methods inherited from class com.jhlabs.image.PointFilter

filter, filterRGB, setDimensions

Methods inherited from class com.jhlabs.image.AbstractBufferedImageOp

clone, createCompatibleDestImage, getBounds2D, getPoint2D, getRGB, getRenderingHints, setRGB

Field Details

dither90Halftone6x6Matrix

public static final int[] dither90Halftone6x6Matrix
6x6 90 degree halftone.

ditherCluster3Matrix

public static final int[] ditherCluster3Matrix
Order-3 clustered dither.

ditherCluster4Matrix

public static final int[] ditherCluster4Matrix
Order-4 clustered dither.

ditherCluster8Matrix

public static final int[] ditherCluster8Matrix
Order-8 clustered dither.

ditherLines4x4Matrix

public static final int[] ditherLines4x4Matrix
4x4 lines.

ditherMagic2x2Matrix

protected static final int[] ditherMagic2x2Matrix
2x2 magic square.

ditherMagic4x4Matrix

protected static final int[] ditherMagic4x4Matrix
4x4 magic square.

ditherOrdered4x4Matrix

public static final int[] ditherOrdered4x4Matrix
4x4 ordered dither.

ditherOrdered6x6Matrix

public static final int[] ditherOrdered6x6Matrix
Order-6 ordered dither.

ditherOrdered8x8Matrix

public static final int[] ditherOrdered8x8Matrix
Order-8 ordered dither.

Constructor Details

DitherFilter

public DitherFilter()
Constuct a DitherFilter.

Method Details

filterRGB

public int filterRGB(int x,
                     int y,
                     int rgb)
Overrides:
filterRGB in interface PointFilter

getLevels

public int getLevels()
Get the number of dither levels.
Returns:
the number of levels

getMatrix

public int[] getMatrix()
Get the dither matrix.
Returns:
the dither matrix

initialize

protected void initialize()
Initialize the filter.

setLevels

public void setLevels(int levels)
Set the number of dither levels.
Parameters:
levels - the number of levels

setMatrix

public void setMatrix(int[] matrix)
Set the dither matrix.
Parameters:
matrix - the dither matrix

toString

public String toString()