Class ColorInterpolator


  • public class ColorInterpolator
    extends Object
    A color interpolation helper class.
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • ColorInterpolator

        public ColorInterpolator​(Color[] colors,
                                 double[] values,
                                 int alpha)
      • ColorInterpolator

        public ColorInterpolator​(String colorTableName,
                                 double min,
                                 double max,
                                 Integer alpha)
    • Method Detail

      • getColorFor

        public Color getColorFor​(double value)
        Get the color of the defined table by its value.
        Parameters:
        value - the value.
        Returns:
        the interpolated color.
      • interpolateColor

        public static Color interpolateColor​(Color color1,
                                             Color color2,
                                             float fraction)
        Interpolate a color at a given fraction between 0 and 1.
        Parameters:
        color1 - start color.
        color2 - end color.
        fraction - the fraction to interpolate.
        Returns:
        the new color.