类 ColorUtil
- java.lang.Object
-
- org.meteoinfo.common.colors.ColorUtil
-
public class ColorUtil extends Object
ColorUtiles class- 作者:
- Yaqiang
-
-
构造器概要
构造器 构造器 说明 ColorUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static ColorcreateColor(Color sColor, Color eColor, float p)Create color from start and end colorstatic Color[]createColors(Color sColor, Color eColor, int cNum)Create colors from start and end colorstatic Color[]createColors(ColorMap cm, double min, double max)Create colorsstatic Color[]createColors(ColorMap cm, double min, double max, int n)Create colorsstatic Color[]createRainBowColors(int cNum)Create rainbow colorsstatic ColorcreateRandomColor()Create a random colorstatic Color[]createRandomColors(int cNum)Create random colorsstatic ColorMapfindColorTable(ColorMap[] cts, String name)Find color tablestatic ColorgetColor(Color color, float alpha)Get new color from existing color and alphastatic ColorgetColor(Color color, int alpha)Get new color from existing color and alphastatic ColorMap[]getColorMaps()Get color tablesstatic ColorMap[]getColorMaps(File pathDir)Get color mapsstatic ColorMap[]getColorMaps(String path)Get color mapsstatic ColorMap[]getColorTables_old()Get color tablesstatic ColorgetCommonColor(int idx)Get common colorstatic Color[]getRainBowColors_HSV(int cNum)Get rainbow color by HSV/HSBstatic ColorMaploadColorMap(String fn)Load color map from rgb filestatic ColorMaploadColorMap(String fn, int alpha)Load color map from rgb filestatic ColormodifyBrightness(Color c, float brightness)Modifies an existing brightness level of a colorstatic ColorparseToColor(String c)Parse hex string to colorstatic StringtoHex(Color color)Convert color r,g,b to hex stringstatic StringtoHexEncoding(Color color)Convert a color to hex stringstatic StringtoKMLColor(Color color)Convert color to KML color string - AABBGGRR
-
-
-
方法详细资料
-
getColor
public static Color getColor(Color color, int alpha)
Get new color from existing color and alpha- 参数:
color- Existing coloralpha- Alpha- 返回:
-
getColor
public static Color getColor(Color color, float alpha)
Get new color from existing color and alpha- 参数:
color- Existing coloralpha- 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 colorbrightness- 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() throws IOException
Get color tables- 返回:
- Color tables
- 抛出:
IOException
-
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 pathalpha- Alpha- 返回:
- Color table
- 抛出:
IOException
-
findColorTable
public static ColorMap findColorTable(ColorMap[] cts, String name)
Find color table- 参数:
cts- Color tablesname- Color table name- 返回:
- Finded color table
-
getColorTables_old
public static ColorMap[] getColorTables_old() throws IOException
Get color tables- 返回:
- Color tables
- 抛出:
IOException
-
createColors
public static Color[] createColors(Color sColor, Color eColor, int cNum)
Create colors from start and end color- 参数:
sColor- Start coloreColor- End colorcNum- Color number- 返回:
- Color array
-
createColors
public static Color[] createColors(ColorMap cm, double min, double max)
Create colors- 参数:
cm- Color mapmin- Min valuemax- Max value- 返回:
- Colors
-
createColors
public static Color[] createColors(ColorMap cm, double min, double max, int n)
Create colors- 参数:
cm- Color mapmin- Min valuemax- Max valuen- Color number- 返回:
- Colors
-
createColor
public static Color createColor(Color sColor, Color eColor, float p)
Create color from start and end color- 参数:
sColor- Start coloreColor- End colorp- 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
-
-