org.gnu.gdk
Class Color
public
class
Color
extends Boxed
Describes an allocated or unallocated color.
A color consists of red, green and blue values in the range 0-65535 and a
pixel value. The pixel value is highly dependent on the depth and colormap
which this color will be used to draw into. Therefore, sharing colors between
colormaps is a bad idea.
Constructor Summary |
| Color(Handle handle)
Construct a Color object from a handle to a native resource. |
| Color(int red, int green, int blue)
Creates an sRGB color with the specified red, green, and blue values in
the range (0 - 65535).
|
Method Summary |
Object | clone()
Makes a copy of this color. |
boolean | equals(Object color)
Determines whether another object is equal to this Color. |
int | getBlue()
Returns the blue component in the range 0-65535 in the default sRGB
space. |
static Color | getColorFromHandle(Handle hndl)
Construct a Color object from a handle to a native resource. |
int | getGreen()
Returns the green component in the range 0-65535 in the default sRGB
space. |
int | getPixel() |
int | getRed()
Returns the red component in the range 0-65535 in the default sRGB space. |
Type | getType() |
int | hashCode() |
static Color | parse(String spec)
Parses a textual specification of a color. |
void | setBlue(short value)
Sets the blue component in the range of 0-65535. |
void | setGreen(short value)
Sets the green component in the range of 0-65535. |
void | setRed(short value)
Sets the red component in the range of 0-65535. |
String | toString()
Returns a string representation of this Color. |
public static final
Color BLACK
public static final
Color BLUE
public static final
Color GREEN
public static final
Color ORANGE
public static final
Color RED
public static final
Color WHITE
public static final
Color YELLOW
public Color(Handle handle)
Construct a Color object from a handle to a native resource.
public Color(int red, int green, int blue)
public Object clone()
Makes a copy of this color.
public boolean equals(Object color)
Determines whether another object is equal to this Color.
public int getBlue()
Returns the blue component in the range 0-65535 in the default sRGB
space.
public static
Color getColorFromHandle(Handle hndl)
Construct a Color object from a handle to a native resource. It should
only be used internally by Java-Gnome.
public int getGreen()
Returns the green component in the range 0-65535 in the default sRGB
space.
public int getPixel()
public int getRed()
Returns the red component in the range 0-65535 in the default sRGB space.
public int hashCode()
public static
Color parse(String spec)
Parses a textual specification of a color. The text string can be in any
of the forms accepted by
XParseColor; these include name for a
color from
rgb.txt, such as
DarkSlateGray or a hex
specification such as 305050.
Parameters: spec
The textual description of the color.
Returns: The new Color object or null if the spec could not be
parsed.
public void setBlue(short value)
Sets the blue component in the range of 0-65535.
public void setGreen(short value)
Sets the green component in the range of 0-65535.
public void setRed(short value)
Sets the red component in the range of 0-65535.
public String toString()
Returns a string representation of this Color.