Package org.geotools.image.palette
Class EfficientInverseColorMapComputation
- Object
-
- 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 SAS
-
-
Field Summary
Fields Modifier and Type Field Description 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 mapprotected int
redQuantizationMask
protected int
truncationBits
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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.
-
-
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.
-
-