|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object echopoint.util.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 java.lang.String[] |
ColorConstantStrings
Array for acceptable Color Constant strings |
static nextapp.echo.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 nextapp.echo.Color |
brighter(nextapp.echo.Color color)
Creates a brighter version of this color. |
static nextapp.echo.Color |
brighter(nextapp.echo.Color color,
double factor)
Creates a brighter version of this color, according to the provided factor. |
static nextapp.echo.Color |
clr(int r,
int g,
int b)
Shortcut synonym for makeColor(r,g,b); |
static nextapp.echo.Color |
clr(java.lang.String colorString)
Shortcut synonym for makeColor(colorString); |
static nextapp.echo.Color |
darker(nextapp.echo.Color color)
Creates a darker version of this color. |
static nextapp.echo.Color |
darker(nextapp.echo.Color color,
double factor)
Creates a darker version of this color, according to the provided factor. |
static nextapp.echo.Color |
findBackground(nextapp.echo.Component comp)
Searchs the heirarchy tree of the component and finds the first non null background Color object. |
static nextapp.echo.Color |
findForeground(nextapp.echo.Component comp)
Searchs the heirarchy tree of the component and finds the first non null foreground Color object. |
static nextapp.echo.Color |
invertColor(nextapp.echo.Color color)
Returns the inversion of a color. |
static boolean |
isColor(java.lang.String colorString)
Returns true if the attrValue is a valid representation of a Color value. |
static java.awt.Color |
makeAwtColor(nextapp.echo.Color echoColor,
java.awt.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 nextapp.echo.Color |
makeColor(int r,
int g,
int b)
Returns a Color object from the red, green and blue integer values. |
static nextapp.echo.Color |
makeColor(java.lang.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 java.lang.String |
makeColorString(nextapp.echo.Color color)
Returns the Color in the form : color(r,g,b); |
static java.lang.String |
makeCSSColor(nextapp.echo.Color color)
Returns the Hex W3C CSS color string for a given color ie #rrggbb |
static java.lang.String |
makeHexColor(nextapp.echo.Color color)
Returns the Hex string for a given color for example 'rrggbb' Note it does NOT have the # character at the front |
static nextapp.echo.Color |
swapRGB(nextapp.echo.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 nextapp.echo.Color |
tint(nextapp.echo.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 java.lang.String[] ColorConstantStrings
public static nextapp.echo.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 nextapp.echo.Color brighter(nextapp.echo.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 nextapp.echo.Color brighter(nextapp.echo.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 nextapp.echo.Color darker(nextapp.echo.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 nextapp.echo.Color darker(nextapp.echo.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 nextapp.echo.Color findBackground(nextapp.echo.Component comp)
EchoInstance.DEFAULT_BACKGROUND
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 nextapp.echo.Color findForeground(nextapp.echo.Component comp)
EchoInstance.DEFAULT_FOREGROUND
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 nextapp.echo.Color invertColor(nextapp.echo.Color color)
color
- - the color to invert
public static java.awt.Color makeAwtColor(nextapp.echo.Color echoColor, java.awt.Color defaultAwtColor)
echoColor
object is null
echoColor
- - the nextapp.echo.Color object to convertdefaultAwtColor
- - the AWT color to use if the echoColor is null
public static java.lang.String makeCSSColor(nextapp.echo.Color color)
color
- - the color to convert to a W3C hex CSS string value
public static java.lang.String makeColorString(nextapp.echo.Color color)
color
- - the color to convert to a color string representation
public static java.lang.String makeHexColor(nextapp.echo.Color color)
color
- the color in question
public static nextapp.echo.Color makeColor(java.lang.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
public static boolean isColor(java.lang.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 nextapp.echo.Color clr(java.lang.String colorString)
makeColor(String)
public static nextapp.echo.Color clr(int r, int g, int b)
makeColor(int, int, int)
public static nextapp.echo.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 nextapp.echo.Color tint(nextapp.echo.Color clr, double red, double green, double blue)
The red, green and blue arguments should be around 1.0
public static nextapp.echo.Color swapRGB(nextapp.echo.Color swapColor, int swapOperation)
swapColor
- - the color to swap the RGB elementsswapOperation
- - the operation to perform
|
EchoPoint 1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |