Package org.geotools.image.palette
Class EfficientInverseColorMapComputation
Object
EfficientInverseColorMapComputation
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 SAS
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intNumber of most significant bits we are going to use from the input color in order to quantize them.protected final intprotected final byte[][]Forward color map.protected final intprotected final byte[]inverse rgb color mapprotected final intprotected final int -
Constructor Summary
ConstructorsConstructorDescriptionEfficientInverseColorMapComputation(byte[][] rgbColorMap, int quantizationBits) EfficientInverseColorMapComputationthat allows us to specify the number of bits we are going to save from the quantization. -
Method Summary
Modifier and TypeMethodDescriptionintgetIndexNearest(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.
-
Field Details
-
bits
protected final int bitsNumber 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[][] colorMapForward color map. Is a 3*numcolors array. -
mapBuf
protected final byte[] mapBufinverse rgb color map
-
-
Constructor Details
-
EfficientInverseColorMapComputation
public EfficientInverseColorMapComputation(byte[][] rgbColorMap, int quantizationBits) EfficientInverseColorMapComputationthat allows us to specify the number of bits we are going to save from the quantization.
-
-
Method Details
-
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.
-