类 ColorUtil


  • public class ColorUtil
    extends Object
    ColorUtiles class
    作者:
    Yaqiang
    • 构造器详细资料

      • ColorUtil

        public ColorUtil()
    • 方法详细资料

      • getColor

        public static Color getColor​(Color color,
                                     int alpha)
        Get new color from existing color and alpha
        参数:
        color - Existing color
        alpha - Alpha
        返回:
      • getColor

        public static Color getColor​(Color color,
                                     float alpha)
        Get new color from existing color and alpha
        参数:
        color - Existing color
        alpha - Alpha
        返回:
      • getCommonColor

        public static Color getCommonColor​(int idx)
        Get common color
        参数:
        idx - Index
        返回:
        Common color
      • toHex

        public static String toHex​(Color color)
        Convert color r,g,b to hex string
        参数:
        color - The color
        返回:
        Hex string
      • toHexEncoding

        public static String toHexEncoding​(Color color)
        Convert a color to hex string
        参数:
        color - a color
        返回:
        Hex string
      • parseToColor

        public static Color parseToColor​(String c)
        Parse hex string to color
        参数:
        c - hex string
        返回:
        Color
      • modifyBrightness

        public static Color modifyBrightness​(Color c,
                                             float brightness)
        Modifies an existing brightness level of a color
        参数:
        c - The color
        brightness - The brightness
        返回:
        Adjusted color
      • toKMLColor

        public static String toKMLColor​(Color color)
        Convert color to KML color string - AABBGGRR
        参数:
        color - The color
        返回:
        KML color string
      • getColorMaps

        public static ColorMap[] getColorMaps​(String path)
                                       throws IOException
        Get color maps
        参数:
        path - Color map path directory string
        返回:
        Color maps
        抛出:
        IOException
      • getColorMaps

        public static ColorMap[] getColorMaps​(File pathDir)
                                       throws IOException
        Get color maps
        参数:
        pathDir - Color map path directory
        返回:
        Color maps
        抛出:
        IOException
      • loadColorMap

        public static ColorMap loadColorMap​(String fn)
                                     throws IOException
        Load color map from rgb file
        参数:
        fn - Color map rgb file path
        返回:
        Color table
        抛出:
        IOException
      • loadColorMap

        public static ColorMap loadColorMap​(String fn,
                                            int alpha)
                                     throws IOException
        Load color map from rgb file
        参数:
        fn - Color map rgb file path
        alpha - Alpha
        返回:
        Color table
        抛出:
        IOException
      • findColorTable

        public static ColorMap findColorTable​(ColorMap[] cts,
                                              String name)
        Find color table
        参数:
        cts - Color tables
        name - Color table name
        返回:
        Finded color table
      • createColors

        public static Color[] createColors​(Color sColor,
                                           Color eColor,
                                           int cNum)
        Create colors from start and end color
        参数:
        sColor - Start color
        eColor - End color
        cNum - Color number
        返回:
        Color array
      • createColors

        public static Color[] createColors​(ColorMap cm,
                                           double min,
                                           double max)
        Create colors
        参数:
        cm - Color map
        min - Min value
        max - Max value
        返回:
        Colors
      • createColors

        public static Color[] createColors​(ColorMap cm,
                                           double min,
                                           double max,
                                           int n)
        Create colors
        参数:
        cm - Color map
        min - Min value
        max - Max value
        n - Color number
        返回:
        Colors
      • createColor

        public static Color createColor​(Color sColor,
                                        Color eColor,
                                        float p)
        Create color from start and end color
        参数:
        sColor - Start color
        eColor - End color
        p - Proportion
        返回:
        Color
      • createRainBowColors

        public static Color[] createRainBowColors​(int cNum)
        Create rainbow colors
        参数:
        cNum - Color number
        返回:
        Rainbow color array
      • getRainBowColors_HSV

        public static Color[] getRainBowColors_HSV​(int cNum)
        Get rainbow color by HSV/HSB
        参数:
        cNum - Color number
        返回:
        Rainbow colors
      • createRandomColor

        public static Color createRandomColor()
        Create a random color
        返回:
        A random color
      • createRandomColors

        public static Color[] createRandomColors​(int cNum)
        Create random colors
        参数:
        cNum - Color number
        返回:
        The random colors