JIU 0.14.3

net.sourceforge.jiu.color.quantization
Class UniformPaletteQuantizer

java.lang.Object
  extended by net.sourceforge.jiu.ops.Operation
      extended by net.sourceforge.jiu.ops.ImageToImageOperation
          extended by net.sourceforge.jiu.color.quantization.UniformPaletteQuantizer
All Implemented Interfaces:
RGBQuantizer, RGBIndex

public class UniformPaletteQuantizer
extends ImageToImageOperation
implements RGBIndex, RGBQuantizer

A color quantizer that maps to a palette which is equidistantly distributed in the RGB color cube. Equidistantly distributed only within each channel.

Author:
Marco Schmidt

Field Summary
 
Fields inherited from interface net.sourceforge.jiu.data.RGBIndex
INDEX_BLUE, INDEX_GREEN, INDEX_RED
 
Constructor Summary
UniformPaletteQuantizer(int redBits, int greenBits, int blueBits)
           
 
Method Summary
 Palette createPalette()
          Return a Palette object with the list of colors to be used in the quantization process.
 int map(int[] origRgb, int[] quantizedRgb)
          This method maps a triplet of intensity values to its quantized counterpart and returns the palette index of that quantized color.
 int mapToIndex(int red, int green, int blue)
           
 void process()
          This method does the actual work of the operation.
 
Methods inherited from class net.sourceforge.jiu.ops.ImageToImageOperation
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage
 
Methods inherited from class net.sourceforge.jiu.ops.Operation
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniformPaletteQuantizer

public UniformPaletteQuantizer(int redBits,
                               int greenBits,
                               int blueBits)
Method Detail

createPalette

public Palette createPalette()
Description copied from interface: RGBQuantizer
Return a Palette object with the list of colors to be used in the quantization process. That palette may be fixed or created specifically for a given input image.

Specified by:
createPalette in interface RGBQuantizer
Returns:
Palette object for destination image

map

public int map(int[] origRgb,
               int[] quantizedRgb)
Description copied from interface: RGBQuantizer
This method maps a triplet of intensity values to its quantized counterpart and returns the palette index of that quantized color. The index values for the two arrays are taken from RGBIndex.

Specified by:
map in interface RGBQuantizer
Parameters:
origRgb - the three samples red, green and blue for which a good match is searched in the palette
quantizedRgb - will hold the three samples found to be closest to origRgb after the call to this method
Returns:
int index in the palette of the match quantizedRgb

mapToIndex

public final int mapToIndex(int red,
                            int green,
                            int blue)

process

public void process()
Description copied from class: Operation
This method does the actual work of the operation. It must be called after all parameters have been given to the operation object.

Overrides:
process in class Operation

JIU 0.14.3

Copyright © 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Marco Schmidt