org.geotools.image.palette
Class EfficientInverseColorMapComputation

Object
  extended by EfficientInverseColorMapComputation

public final class EfficientInverseColorMapComputation
extends Object

This class is responsible for computing efficiently an inverse color map for a given color map.

This algorithm is adapted from the algorithm found in Graphics Gems volume 2 by Spencer W. Thomas "Efficient Inverse Color Map Computation".

Author:
Simone Giannecchini. GeoSOlutions
Module:
modules/library/coverage (gt-coverage.jar)

Field Summary
protected  int bits
          Number of most significant bits we are going to use from the input color in order to quantize them.
protected  int blueQuantizationMask
           
protected  byte[][] colorMap
          Forward color map.
protected  int greenQuantizationMask
           
protected  byte[] mapBuf
          inverse rgb color map
protected  int redQuantizationMask
           
protected  int truncationBits
           
 
Constructor Summary
EfficientInverseColorMapComputation(byte[][] rgbColorMap, int quantizationBits)
          EfficientInverseColorMapComputation that allows us to specify the number of bits we are going to save from the quantization.
 
Method Summary
 int getIndexNearest(int red, int green, int blue)
          This method is responsible for doing the actual lookup that given an rgb triple returns the best, taking into account quantization, index in the forward color map.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bits

protected final int bits
Number of most significant bits we are going to use from the input color in order to quantize them.


truncationBits

protected final int truncationBits

blueQuantizationMask

protected final int blueQuantizationMask

greenQuantizationMask

protected final int greenQuantizationMask

redQuantizationMask

protected final int redQuantizationMask

colorMap

protected final byte[][] colorMap
Forward color map. Is a 3*numcolors array.


mapBuf

protected final byte[] mapBuf
inverse rgb color map

Constructor Detail

EfficientInverseColorMapComputation

public EfficientInverseColorMapComputation(byte[][] rgbColorMap,
                                           int quantizationBits)
EfficientInverseColorMapComputation that allows us to specify the number of bits we are going to save from the quantization.

Parameters:
rgbColorMap -
quantizationBits -
Method Detail

getIndexNearest

public int getIndexNearest(int red,
                           int green,
                           int blue)
This method is responsible for doing the actual lookup that given an rgb triple returns the best, taking into account quantization, index in the forward color map.

Parameters:
red - component.
green - component.
blue - component.
Returns:
the best, taking into account quantization, index in the forward color map for the provided triple.


Copyright © 1996-2009 Geotools. All Rights Reserved.