public class OMColor
extends java.awt.Color
The OMColor object captures all calls that reference the
package-internal java.awt.Color.value
slot, and
re-route them through the local argb slot.
NOTE concerning the OpenMap 4.0 release. As of 4.0, OpenMap now has a minimum jdk 1.2 requirement, which means that OMColor seems to duplicate java.awt.Color. We're going to keep this class around, however, in case someone needs a mutable Color.
ColorFactory
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int |
argb
The 32bit ARGB value used.
|
static java.awt.Color |
clear
Default transparent color.
|
Constructor and Description |
---|
OMColor(float a,
float r,
float g,
float b)
Deprecated.
This function does not correctly override the JDK // *
1.2 java.awt.Color constructor with the same
type/number of // * arguments. It should be
OMColor(float r, float g, float b, float a).
|
OMColor(int argb)
Create a color with the specified ARGB (Alpha, Red, Green, and
Blue) values.
|
OMColor(int a,
int r,
int g,
int b)
Deprecated.
This function does not correctly override the JDK // *
1.2 java.awt.Color constructor with the same
type/number of // * arguments. It should be
OMColor(int r, int g, int b, int a).
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Determines whether another object is equal to this color.
|
int |
getAlpha()
Return the transparency value of the color (the value of the
24-31 bits).
|
int |
getBlue()
Return the blue value of the color (the value of the 0-7 bits).
|
int |
getGreen()
Return the green value of the color (the value of the 8-15
bits).
|
int |
getRed()
Return the red value of the color (the value of the 16-23
bits).
|
int |
getRGB()
Get the ARGB (alpha, red, green and blue) value representing
the color in the default RGB ColorModel.
|
int |
hashCode()
Computes the hash code for this color.
|
static boolean |
isClear(java.awt.Color value)
Checks if the color is transparent.
|
void |
setAlpha(int value)
Set the transparency value of the OMColor.
|
void |
setBlue(int value)
Set the blue value of the OMColor.
|
void |
setGreen(int value)
Set the green value of the OMColor.
|
void |
setRed(int value)
Set the red value of the OMColor.
|
void |
setRGB(int value)
Change the ARGB value of the color the input value.
|
static int |
setTransparentValue(int colorValue,
float transValue)
Return a color value that has the transparency alpha value set
to a percentage value between 0.0 and 1.0.
|
static int |
setTransparentValue(int colorValue,
int transValue)
Return a color integer that has the transparency alpha value
set to a value between 0-255.
|
java.lang.String |
toString()
Returns a string representation of this color.
|
public static final transient java.awt.Color clear
protected int argb
public OMColor(int a, int r, int g, int b)
public OMColor(int argb)
argb
- 32bit Hex ARGB valuepublic OMColor(float a, float r, float g, float b)
public int getRGB()
getRGB
in class java.awt.Color
public void setRGB(int value)
value
- the transparency value between 0-255.public int getRed()
getRed
in class java.awt.Color
public void setRed(int value)
value
- the red value between 0-255.public int getGreen()
getGreen
in class java.awt.Color
public void setGreen(int value)
value
- the green value between 0-255.public int getBlue()
getBlue
in class java.awt.Color
public void setBlue(int value)
value
- the blue value between 0-255.public int getAlpha()
getAlpha
in class java.awt.Color
public void setAlpha(int value)
value
- the transparency value between 0-255.public static int setTransparentValue(int colorValue, int transValue)
colorValue
- the ARGB value of a color to be changed.transValue
- the integer (0-255) representing the
opaqueness of the return value. 0 is transparent, 255 is
opaque.public static int setTransparentValue(int colorValue, float transValue)
colorValue
- the RGB value of a color to be changed.transValue
- the percentage of opaqueness (0-1) of the
return value. 0 is transparent, 1 is opaque.public static boolean isClear(java.awt.Color value)
value
- Color to be checkedpublic int hashCode()
hashCode
in class java.awt.Color
public boolean equals(java.lang.Object obj)
The result is true
if and only if the argument
is not null
and is a Color
object
that has the same alpha, red, green, and blue values as this
object.
equals
in class java.awt.Color
obj
- the Color to compare.public java.lang.String toString()
null
.toString
in class java.awt.Color
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details