|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.ColorTools
public class ColorTools
Color handling and conversion tools
Nested Class Summary | |
---|---|
static class |
ColorTools.RGB
RGB class. |
Constructor Summary | |
---|---|
ColorTools()
|
Method Summary | |
---|---|
static java.awt.Color |
darker(java.awt.Color c,
double percent)
Creates a new Color that is darker than the specified Color |
static java.awt.Color |
darker(java.awt.Color c,
float percent)
Creates a new Color that is darker than the specified Color |
static boolean |
isColor(java.lang.String color)
Returns true if the specified string is a valid color |
static java.awt.Color |
lighter(java.awt.Color c,
double percent)
Creates a new Color that is lighter than the specified Color |
static java.awt.Color |
lighter(java.awt.Color c,
float percent)
Creates a new Color that is lighter than the specified Color |
static void |
main(java.lang.String[] argv)
|
static java.awt.Color |
mix(java.awt.Color color1,
java.awt.Color color2)
Creates a new Color that is the average of the 2 specified Colors, based on a 50% weighting from the first Color to the second Color. |
static java.awt.Color |
mix(java.awt.Color color1,
java.awt.Color color2,
double weight)
Creates a new Color that is a mix of the 2 specified Colors, based on the specified 'weighting' from the first Color to the second Color. |
static java.awt.Color |
mix(java.awt.Color color1,
java.awt.Color color2,
float weight)
Creates a new Color that is a mix of the 2 specified Colors, based on the specified 'weighting' from the first Color to the second Color. |
static java.awt.Color |
parseColor(java.lang.String color,
java.awt.Color dft)
Parses the Color String representation into a Color instance. |
static ColorTools.RGB |
parseColor(java.lang.String color,
ColorTools.RGB dft)
Parses the Color String representation into a Color instance. |
static java.awt.Color |
randomColor()
Returns a random color |
static java.awt.Color |
randomColor(java.util.Random R)
Returns a random color |
static java.lang.String |
toHexString(java.awt.Color color)
Returns a hex String representation of the specified Color. |
static java.lang.String |
toHexString(java.awt.Color color,
boolean inclHash)
Returns a hex String representation of the specified Color. |
static java.lang.String |
toHexString(int color,
boolean inclHash)
Returns a hex String representation of the specified Color. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static ColorTools.RGB BLACK
public static ColorTools.RGB BROWN
public static ColorTools.RGB RED
public static ColorTools.RGB ORANGE
public static ColorTools.RGB YELLOW
public static ColorTools.RGB DARK_YELLOW
public static ColorTools.RGB GREEN
public static ColorTools.RGB BLUE
public static ColorTools.RGB PURPLE
public static ColorTools.RGB GRAY
public static ColorTools.RGB DARK_GRAY
public static ColorTools.RGB LIGHT_GRAY
public static ColorTools.RGB WHITE
public static ColorTools.RGB CYAN
public static ColorTools.RGB PINK
public static ColorTools.RGB MAGENTA
public static ColorTools.RGB COLOR_BLACK
public static ColorTools.RGB COLOR_BROWN
public static ColorTools.RGB COLOR_RED
public static ColorTools.RGB COLOR_ORANGE
public static ColorTools.RGB COLOR_YELLOW
public static ColorTools.RGB COLOR_DARK_YELLOW
public static ColorTools.RGB COLOR_GREEN
public static ColorTools.RGB COLOR_BLUE
public static ColorTools.RGB COLOR_PURPLE
public static ColorTools.RGB COLOR_GRAY
public static ColorTools.RGB COLOR_DARK_GRAY
public static ColorTools.RGB COLOR_LIGHT_GRAY
public static ColorTools.RGB COLOR_WHITE
public static ColorTools.RGB COLOR_CYAN
public static ColorTools.RGB COLOR_PINK
public static ColorTools.RGB COLOR_MAGENTA
public static java.awt.Color black
public static java.awt.Color brown
public static java.awt.Color red
public static java.awt.Color orange
public static java.awt.Color yellow
public static java.awt.Color darkYellow
public static java.awt.Color green
public static java.awt.Color blue
public static java.awt.Color purple
public static java.awt.Color gray
public static java.awt.Color darkGray
public static java.awt.Color lightGray
public static java.awt.Color white
public static java.awt.Color cyan
public static java.awt.Color pink
public static java.awt.Color magenta
Constructor Detail |
---|
public ColorTools()
Method Detail |
---|
public static ColorTools.RGB parseColor(java.lang.String color, ColorTools.RGB dft)
color
- The color String representation to parsedft
- The default Color returned if unable to parse a Color from the String
public static boolean isColor(java.lang.String color)
color
- The color String representation to test
public static java.awt.Color lighter(java.awt.Color c, double percent)
c
- The Color to make lighterpercent
- The percent to make lighter
public static java.awt.Color lighter(java.awt.Color c, float percent)
c
- The Color to make lighterpercent
- The percent to make lighter
public static java.awt.Color darker(java.awt.Color c, double percent)
c
- The Color to make darkerpercent
- The percent to make darker
public static java.awt.Color darker(java.awt.Color c, float percent)
c
- The Color to make darkerpercent
- The percent to make darker
public static java.awt.Color mix(java.awt.Color color1, java.awt.Color color2)
color1
- The first Color which will be averagedcolor2
- The second Color which will be averaged
public static java.awt.Color mix(java.awt.Color color1, java.awt.Color color2, float weight)
color1
- The first Color which will be averagedcolor2
- The second Color which will be averagedweight
- The 'weighting' from the first Color to the second Color.
A 'weight' of '0.0' will produce the first Color.
A 'weight' of '1.0' will produce the second Color.
public static java.awt.Color mix(java.awt.Color color1, java.awt.Color color2, double weight)
color1
- The first Color which will be averagedcolor2
- The second Color which will be averagedweight
- The 'weighting' from the first Color to the second Color.
A 'weight' of '0.0' will produce the first Color.
A 'weight' of '1.0' will produce the second Color.
public static java.awt.Color parseColor(java.lang.String color, java.awt.Color dft)
color
- The color String representation to parsedft
- The default Color returned if unable to parse a Color from the String
public static java.awt.Color randomColor(java.util.Random R)
R
- The radomizer (null to create a new Random instance)
public static java.awt.Color randomColor()
public static java.lang.String toHexString(java.awt.Color color)
color
- The Color to convert to a String representation
public static java.lang.String toHexString(java.awt.Color color, boolean inclHash)
color
- The Color to convert to a String representationinclHash
- Prefix with '#' if true
public static java.lang.String toHexString(int color, boolean inclHash)
color
- The RGB value to convert to a String representationinclHash
- Prefix with '#' if true
public static void main(java.lang.String[] argv)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |