com.sun.jimi.core.util
Class ColorReducer

java.lang.Object
  |
  +--com.sun.jimi.core.util.ColorReducer

public class ColorReducer
extends java.lang.Object

ColorReducer performs color reduction, with optional dithering, on an image to convert it to use a fixed-size palette. It can reduce the number of colors used by a palette image, or convert an RGB image to a palette image.


Field Summary
protected  boolean dither_
           
protected  JimiImageColorReducer reducer_
           
 
Constructor Summary
ColorReducer(int maxColors)
          Creates a ColorReducer to perform color reduction on an Image without any dithering.
ColorReducer(int maxColors, boolean dither)
          Creates a ColorReducer to perform color reduction on an Image.
 
Method Summary
protected  JimiRasterImage doColorReduction(java.awt.image.ImageProducer producer)
           
 java.awt.Image getColorReducedImage(java.awt.Image image)
          Perform color reduction.
 java.awt.Image getColorReducedImage(java.awt.image.ImageProducer producer)
          Perform color reduction.
 java.awt.image.ImageProducer getColorReducedImageProducer(java.awt.Image image)
          Perform color reduction.
 java.awt.image.ImageProducer getColorReducedImageProducer(java.awt.image.ImageProducer producer)
          Perform color reduction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reducer_

protected JimiImageColorReducer reducer_

dither_

protected boolean dither_
Constructor Detail

ColorReducer

public ColorReducer(int maxColors)
Creates a ColorReducer to perform color reduction on an Image without any dithering.
Parameters:
maxColors - the maximum number of colors in the reduced image

ColorReducer

public ColorReducer(int maxColors,
                    boolean dither)
Creates a ColorReducer to perform color reduction on an Image.
Parameters:
maxColors - the maximum number of colors in the reduced image
dither - true if the image should be dithered to create smoother results
Method Detail

getColorReducedImageProducer

public java.awt.image.ImageProducer getColorReducedImageProducer(java.awt.image.ImageProducer producer)
                                                          throws JimiException
Perform color reduction.
Parameters:
producer - the ImageProducer to draw image data from

getColorReducedImageProducer

public java.awt.image.ImageProducer getColorReducedImageProducer(java.awt.Image image)
                                                          throws JimiException
Perform color reduction.
Parameters:
image - the Image to draw image data from

getColorReducedImage

public java.awt.Image getColorReducedImage(java.awt.image.ImageProducer producer)
                                    throws JimiException
Perform color reduction.
Parameters:
producer - the ImageProducer to draw image data from

getColorReducedImage

public java.awt.Image getColorReducedImage(java.awt.Image image)
                                    throws JimiException
Perform color reduction.
Parameters:
image - the Image to draw image data from

doColorReduction

protected JimiRasterImage doColorReduction(java.awt.image.ImageProducer producer)
                                    throws JimiException