|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.yospace.yae.yogi.ColorUtil
This class provides a set of static constants representing integer color values, and a set of static utility methods for manipulating them. This class cannot be instantiated.
| Field Summary | |
static int |
BLACK
integer color with value 0x000000 |
static int |
BLUE
integer color with value 0x0000FF |
static int |
CYAN
integer color with value 0x00FFFF |
static int |
DARK
Used to indicate "darkening" for getShadedColor(color,shade) |
static int |
DARK_GRAY
integer color with value 0x404040 |
static int |
GRAY
integer color with value 0x808080 |
static int |
GREEN
integer color with value 0x00FF00 |
static int |
LIGHT
Used to indicate "lightening" for getShadedColor(color,shade) |
static int |
LIGHT_GRAY
integer color with value 0xC0C0C0 |
static int |
MAGENTA
integer color with value 0xFF00FF |
static int |
ORANGE
integer color with value 0xFFC800 |
static int |
PINK
integer color with value 0xFFAFAF |
static int |
RED
integer color with value 0xFF0000 |
static int |
WHITE
integer color with value 0xFFFFFF |
static int |
YELLOW
integer color with value 0xFFFF00 |
| Method Summary | |
static int |
getColor(int r,
int g,
int b)
Gives the color value for the color specified by its red, green and blue components. |
static int |
getShadedColor(int color,
int shade)
This method takes a color and lightens or darkens it. |
static int |
parseColor(java.lang.String s)
Parses a string denoting a color name, and returns the relevant integer value. |
static java.lang.String |
toString(int color)
This method is the converse of parseColor(color)
above. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int BLACK
public static final int WHITE
public static final int RED
public static final int GREEN
public static final int BLUE
public static final int PINK
public static final int ORANGE
public static final int YELLOW
public static final int MAGENTA
public static final int CYAN
public static final int LIGHT_GRAY
public static final int GRAY
public static final int DARK_GRAY
public static final int DARK
getShadedColor(color,shade)public static final int LIGHT
getShadedColor(color,shade)| Method Detail |
public static int getColor(int r,
int g,
int b)
r - the value of the red component of the desired color, from 0 to 255.g - the value of the green component of the desired color, from 0 to 255.b - the value of the blue component of the desired color, from 0 to 255.java.lang.IllegalArgumentException - if any color component is out of range
public static int getShadedColor(int color,
int shade)
color - the starting colorshade - one of LIGHT or DARK
public static int parseColor(java.lang.String s)
throws java.lang.IllegalArgumentException
If the color name is not recognised or the RGB representation is invalid then an IllegalArgumentException is thrown.
s - the String representation of the color. This is non-case-sensitive, and the accepted names
are the same as the constant names defined in this class (e.g., BLACK, WHITE, etc.).java.lang.IllegalArgumentException - if s is neither one of the color names, nor a hex-number, nor
a ','-separated list of 3 numbers with no spaces.public static java.lang.String toString(int color)
parseColor(color)
above. Given a color value, it will produce the corresponding string name in English,
or a hex string with a leading "0x" if not a recognized value.color - a number representing a color in 0xRRGGBB formatparseColor(color)
|
Copyright 2002 Yospace Holdings Ltd. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||