|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcontrol.graphics.Color
public final class Color
The class Color stores a color and offers several functions for decoding and manipulation. The stored color cosists of four 8-bit parameters: red, green, blue and alpha values. Internally a 32-bit ARGB value is used for storing (0x AA RR GG BB). which is compatible to the color functions of the Display class.
Field Summary | |
---|---|
static Color |
BLACK
The color black. |
static Color |
BLUE
The color blue. |
static Color |
CYAN
The color cyan. |
static Color |
DARK_GRAY
The color dark gray. |
static Color |
GRAY
The color gray. |
static Color |
GREEN
The color green. |
static Color |
LIGHT_GRAY
The color light gray. |
static Color |
MAGENTA
The color magenta. |
static Color |
ORANGE
The color orange. |
static Color |
PINK
The color pink. |
static Color[] |
rainbowColors
A rainbow color Array. |
static Color |
RED
The color red. |
static Color |
WHITE
The color white. |
static Color |
YELLOW
The color yellow. |
Constructor Summary | |
---|---|
Color(Color c)
Constructor: creates a new Color-Object by overgiven Color |
|
Color(int c)
Constructor: creates a new Color-Object by overgiven RGB-Value |
|
Color(int r,
int g,
int b)
Constructor: creates a new Color-Object by overgiven separated RGB-Values |
|
Color(int r,
int g,
int b,
int a)
Constructor: creates a new Color-Object by overgiven separated RGB-Values with alpha |
Method Summary | |
---|---|
int |
getAlpha()
Returns the alpha value. |
static int |
getAlphaFromRGB(int argb)
Decodes a given 32bit integer value and returns its alpha fraction |
int |
getBlue()
Returns the blue value. |
static int |
getBlueFromRGB(int argb)
Decodes a given 32bit integer value and returns its blue fraction |
int |
getGreen()
Returns the green value. |
static int |
getGreenFromRGB(int argb)
Decodes a given 32bit integer value and returns its green fraction |
int |
getRed()
Returns the red value. |
static int |
getRedFromRGB(int argb)
Decodes a given ARGB value and returns its red fraction |
int |
getRGB()
Returns the ARGB value of this Color |
static int |
getRGB(Color c)
Returns ARGB value of the given Color |
static int |
getRGB(int r,
int g,
int b,
int a)
Returns the ARGB value of the given color-ammounts |
static Color |
invertColor(Color c)
Inverts a Color. |
boolean |
isOpaque()
Checks if the Color is opaque ( alpha = 255). |
void |
setColor(int r,
int g,
int b)
Sets the Color's separate red, green and blue values. |
void |
setColor(int r,
int g,
int b,
int a)
Sets the Color's separate red, green, blue and alpha values. |
void |
setRGB(int v)
Sets the ARGB value of this Color |
String |
toString()
creates a human readable color description-string |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, notifyAll, wait |
Field Detail |
---|
public static final Color WHITE
public static final Color LIGHT_GRAY
public static final Color GRAY
public static final Color DARK_GRAY
public static final Color BLACK
public static final Color RED
public static final Color PINK
public static final Color ORANGE
public static final Color YELLOW
public static final Color GREEN
public static final Color MAGENTA
public static final Color CYAN
public static final Color BLUE
public static final Color[] rainbowColors
Constructor Detail |
---|
public Color(Color c)
c
- public Color(int c)
c
- public Color(int r, int g, int b)
c
- public Color(int r, int g, int b, int a)
c
- Method Detail |
---|
public int getRGB()
public static int getRGB(Color c)
c
- Color to get integer value from
public void setRGB(int v)
v
- new ARGB valuepublic void setColor(int r, int g, int b)
r
- red value (0-255)g
- green value (0-255)b
- blue value (0-255)public void setColor(int r, int g, int b, int a)
r
- red value (0-255)g
- green value (0-255)b
- blue value (0-255)a
- alpha value (0-255)public int getRed()
public int getGreen()
public int getBlue()
public int getAlpha()
public boolean isOpaque()
public static int getRedFromRGB(int argb)
argb
- 32bit integer value (0x aa rr gg bb)
public static int getGreenFromRGB(int argb)
argb
- 32bit integer value (0x aa rr gg bb)
public static int getBlueFromRGB(int argb)
argb
- 32bit integer value (0x aa rr gg bb)
public static int getAlphaFromRGB(int argb)
argb
- 32bit integer value (0x aa rr gg bb)
public static Color invertColor(Color c)
c
- Color
public static int getRGB(int r, int g, int b, int a)
r
- ammount of redg
- ammount of greenb
- ammound of bluea
- alpha value
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |