Interface ContourPlot.ColorMap

  • All Known Implementing Classes:
    ContourPlot.DefaultColorMap, ContourPlot.SimpleColorMap
    Enclosing class:
    ContourPlot

    public static interface ContourPlot.ColorMap
    The ColorMap interface defines discrete mapping from a fixed integer interval [0..N-1] to colors through the getColor(int) method. It also defines a continuous mapping from the unit interval [0,1] to colors through the interpolate(double) method. For this each of the discrete colors is mapped to a location within the unit interval [0,1] with the first color mapping to 0 and the last mapping to 1. The colors in between have arbitrary but ascending locations within ]0,1[ which can be accessed using getLocation(int).
    Author:
    hageldave
    • Method Detail

      • getColor

        int getColor​(int i)
        Returns the ith color
        Parameters:
        i - index of the color
        Returns:
        ith color in integer packed ARGB format (0xff00ff00 is opaque green)
      • getColors

        int[] getColors()
        Returns:
        all discrete colors in this ContourPlot.ColorMap in integer packed ARGB format (0xff00ff00 is opaque green)
      • getLocation

        double getLocation​(int i)
        Returns the location of the ith color within the unit interval.
        Parameters:
        i - index of the location/color
        Returns:
        location within [0,1]
      • getLocations

        double[] getLocations()
        Returns:
        all locations of the discrete colors in this ContourPlot.ColorMap
      • interpolate

        default int interpolate​(double m)
        linearly interpolates colors for the specified location of the unit interval.
        Parameters:
        m - location within [0,1]
        Returns:
        the interpolated color for specified location in integer packed ARGB format (0xff00ff00 is opaque green)
      • resample

        default ContourPlot.SimpleColorMap resample​(int numSamples,
                                                    double start,
                                                    double end)
        Returns a uniformly sampled version of this map with the specified number of samples within the specified interval.
        Parameters:
        numSamples - number of uniform samples
        start - of sampling interval within [0,1[
        end - of sampling interval within ]0,1]
        Returns:
        re-sampled map