|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectechopoint.util.ColorKit
public class ColorKit
A utility to class to help with Color manipulation
| Field Summary | |
|---|---|
static double |
COLOR_FACTOR
The default scale factor applied to the brighter and darker functions |
static String[] |
ColorConstantStrings
Array for acceptable Color Constant strings |
static Color[] |
ColorConstantValues
An array for Color values matching ColorConstantStrings |
static int |
SWAP_OP_BGR
swapRGB Operation - R = B, G = G, B = R |
static int |
SWAP_OP_BRG
swapRGB Operation - R = B, G = R, B = G |
static int |
SWAP_OP_GBR
swapRGB Operation - R = G, G = B, B = R |
static int |
SWAP_OP_GRB
swapRGB Operation - R = G, G = R, B = B |
static int |
SWAP_OP_RBG
swapRGB Operation - R = R, G = B, B = G |
| Method Summary | |
|---|---|
static Color |
brighter(Color color)
Creates a brighter version of this color. |
static Color |
brighter(Color color,
double factor)
Creates a brighter version of this color, according to the provided factor. |
static Color |
clr(int rgb)
Shortcut synonym for makeColor(rgb); |
static Color |
clr(int r,
int g,
int b)
Shortcut synonym for makeColor(r,g,b); |
static Color |
clr(String colorString)
Shortcut synonym for makeColor(colorString); |
static Color |
darker(Color color)
Creates a darker version of this color. |
static Color |
darker(Color color,
double factor)
Creates a darker version of this color, according to the provided factor. |
static Color |
findBackground(Component comp)
Searchs the heirarchy tree of the component and finds the first non null background Color object. |
static Color |
findForeground(Component comp)
Searchs the heirarchy tree of the component and finds the first non null foreground Color object. |
static Color |
invertColor(Color color)
Returns the inversion of a color. |
static boolean |
isColor(String colorString)
Returns true if the propertyValue is a valid representation of a Color value. |
static Color |
makeAwtColor(Color echoColor,
Color defaultAwtColor)
Creates an java.awt.Color object from a nextapp.echo.Color object, or uses the default AWT if the echoColor object is null |
static Color |
makeColor(int rgb)
Returns a Color object from the red, green and blue integer values. |
static Color |
makeColor(int r,
int g,
int b)
Returns a Color object from the red, green and blue integer values. |
static Color |
makeColor(String colorString)
Returns a Color object from the string representation The color string must be in the format : - #rrggbb where rr, gg, bb are hexidecimal integer values - rgb( r, g, b) where r,g,b are integer values - color( r, g, b) where r,g,b are integer values - null will return a null color otherwise an IllegalArgumentException is thrown. |
static String |
makeColorString(Color color)
Returns the Color in the form : color(r,g,b); |
static String |
makeCSSColor(Color color)
Returns the Hex W3C CSS color string for a given color ie #rrggbb |
static String |
makeHexColor(Color color)
Returns the Hex string for a given color for example 'rrggbb' Note it does NOT have the # character at the front |
static Color |
swapRGB(Color swapColor,
int swapOperation)
This will swap the red/green/blue elements of a color according to the swapOperation, which may be one of : SWAP_OP_RBG SWAP_OP_BGR SWAP_OP_BRG SWAP_OP_GRB SWAP_OP_GBR |
static Color |
tint(Color clr,
double red,
double green,
double blue)
Tints a given color by a factor given in red, blue and green. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static String[] ColorConstantStrings
public static Color[] ColorConstantValues
public static final double COLOR_FACTOR
public static final int SWAP_OP_BGR
public static final int SWAP_OP_BRG
public static final int SWAP_OP_GBR
public static final int SWAP_OP_GRB
public static final int SWAP_OP_RBG
| Method Detail |
|---|
public static Color brighter(Color color)
This method applies a 0.7 scale factor to each of the three RGB
components of the color to create a brighter version of the same
color. Although brighter and darker are
inverse operations, the results of a series of invocations of
these two methods may be inconsistent because of rounding errors.
color - - the color to make brighter
Color object, a brighter version of the color.
public static Color brighter(Color color,
double factor)
This method applies an the scale factor to each of the three RGB
components of the color to create a brighter version of the same
color. Although brighter and darker are
inverse operations, the results of a series of invocations of
these two methods may be inconsistent because of rounding errors.
color - - the color to make brighterfactor - - the factor by which to make it brighter.
Color object, a brighter version of the color.public static Color darker(Color color)
This method applies an arbitrary 0.7 scale factor to each of the three RGB
components of the color to create a darker version of the same
color. Although brighter and darker are
inverse operations, the results of a series of invocations of
these two methods may be inconsistent because of rounding errors.
color - - the color to make darker
Color object,a darker version of this color.
public static Color darker(Color color,
double factor)
This method applies an the scale factor to each of the three RGB
components of the color to create a darker version of the same
color. Although brighter and darker are
inverse operations, the results of a series of invocations of
these two methods may be inconsistent because of rounding errors.
color - - the color to make darkerfactor - - the factor by whcih to make it darker.
Color object,a darker version of the color.public static Color findBackground(Component comp)
Color.WHITE if no ancestor components have
a background set, but in practice this is unlikely to be the case.
comp - - the component to start searching at
public static Color findForeground(Component comp)
Color.BLACK. if no ancestor components have
a background set, but in practice this is unlikely to be the case.
comp - - the component to start searching at
public static Color invertColor(Color color)
color - - the color to invert
public static Color makeAwtColor(Color echoColor,
Color defaultAwtColor)
echoColor object is null
echoColor - - the nextapp.echo2.app.Color object to convertdefaultAwtColor - - the AWT color to use if the echoColor is null
public static String makeCSSColor(Color color)
color - - the color to convert to a W3C hex CSS string value
public static String makeColorString(Color color)
color - - the color to convert to a color string representation
public static String makeHexColor(Color color)
color - the color in question
public static Color makeColor(String colorString)
The color string must be in the format :
- #rrggbb where rr, gg, bb are hexidecimal integer values
- rgb( r, g, b) where r,g,b are integer values
- color( r, g, b) where r,g,b are integer values
- null will return a null color
otherwise an IllegalArgumentException is thrown.
The results of these operations are cached in a static cache, so that Color objects can be re-used. This is okay since Color objects are immutable.
colorString - - the color string representation
IllegalArgumentException - - if the string cannot be converted
to a colorpublic static boolean isColor(String colorString)
The allowable forms are :
- colorconstant where colorconstant in (red,blue,green...)
- #rrggbb where rr, gg, bb are hexidecimal integer values
- rgb( r, g, b) where r,g,b are integer values
- color( r, g, b) where r,g,b are integer values
public static Color clr(String colorString)
makeColor(String)
public static Color clr(int r,
int g,
int b)
makeColor(int, int, int)public static Color clr(int rgb)
makeColor(int)
public static Color makeColor(int r,
int g,
int b)
The results of these operations are cached in a static cache, so that Color objects can be re-used. This is okay since Color objects are immutable.
r - - the red color componentg - - the green color componentb - - the blue color component
public static Color makeColor(int rgb)
The results of these operations are cached in a static cache, so that Color objects can be re-used. This is okay since Color objects are immutable.
rgb - - the red/blue/green integer color value
public static Color tint(Color clr,
double red,
double green,
double blue)
The red, green and blue arguments should be around 1.0
public static Color swapRGB(Color swapColor,
int swapOperation)
swapColor - - the color to swap the RGB elementsswapOperation - - the operation to perform
|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||