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 Details

    • 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 Details

    • 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 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.