Class ColorMapCSS.Index

Enclosing class:
ColorMapCSS

public static class ColorMapCSS.Index extends ColorMap.Index<String>
Associates integer indices with colors.
  • Constructor Details

    • Index

      public Index(Color[] colors)
      Construct a new Index color map.
      Parameters:
      colors - the array of colors to assign to indices
    • Index

      public Index(Color[] colors, int alpha)
      Construct a new Index color map with transparency where \(\alpha\in[0,255]\) with \(0\) fully transparent and \(255\) fully opaque.

      Note: this is a convenient way to generate maps with a different transparency. The transparency of the supplied colors is always honoured but overruled if alpha != 255.

      Parameters:
      colors - the array of colors to assign to indices
      alpha - the alpha value for opaque colors
  • Method Details

    • color2Color

      public String color2Color(Color color)
      Description copied from class: ColorMap
      Utility method to convert the color into a color object of type T.
      Specified by:
      color2Color in class ColorMap<String>
      Parameters:
      color - the color to convert
      Returns:
      the color represented as an object of type T
    • toGradient1D

      public ColorMap.Gradient1D<String> toGradient1D(int nIncr)
      Description copied from class: ColorMap.Index
      Convert the index colors into a 1D gradient with a total of nIncr shades.
      Specified by:
      toGradient1D in class ColorMap.Index<String>
      Parameters:
      nIncr - the total number of color increments
      Returns:
      the 1D color gradient