JIGL
v1.6

jigl.image.ops
Class Dither

java.lang.Object
  |
  +--jigl.image.SimpleOperator
        |
        +--jigl.image.ops.Dither
All Implemented Interfaces:
Operator

public class Dither
extends SimpleOperator

This class provides the basic Floyd-Steinberg algorithm for dithering. The weights used are 7/16, 3/16, 5/16, 1/16. Supports ColorImage.

See Also:
Floyd-Steinberg Dithering

Field Summary
private  int exact
           
(package private)  int threshold
           
private  KdTree tree2
          Stores the image.
 
Constructor Summary
Dither(RealColorImage paletteImage)
          Creates a new instance of Dither.
 
Method Summary
protected  Image apply(ColorImage image)
          Applies the palette to a ColorImage applying Floyd-Steinberg dithering.
private  float[] findBest(float[] best)
          Utility methods
static void main(String[] arg)
          This will test the functionality of this function
 
Methods inherited from class jigl.image.SimpleOperator
apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply, apply
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tree2

private KdTree tree2
Stores the image.


threshold

int threshold

exact

private int exact
Constructor Detail

Dither

public Dither(RealColorImage paletteImage)
Creates a new instance of Dither. Note, this function uses a KdTree which is calculated in this constructor.

See Also:
KdTree
Method Detail

apply

protected Image apply(ColorImage image)
Applies the palette to a ColorImage applying Floyd-Steinberg dithering. Returned Image is a ColorImage. image is not modified.

Overrides:
apply in class SimpleOperator
Parameters:
image - ColorImage to dither
Returns:
ColorImage

findBest

private float[] findBest(float[] best)
Utility methods


main

public static void main(String[] arg)
                 throws Object
This will test the functionality of this function

Object

JIGL
v1.6

Submit a bug or feature
Revised in May 2002 by Weiming Liu