|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Color
com.bbn.openmap.omGraphics.OMColor
The OMColor exists to provide a way to make a color that can have some degree of transparency. The class lets you set the alpha value of the color which lets the color be invisible (0) to opaque (255). At this time, the java.awt.Graphics class does not support transparency for drawing objects (OMLines, OMRects, OMCircles, etc.) but the transparent colors work for OMBitmap and OMRaster pixel values.
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 FormField Summary | |
static java.lang.reflect.Constructor |
alphaValueConstructor
A constructor object which can be used to create new java.awt.Colors for java.version >= 1.2 . |
protected int |
argb
The 32bit ARGB value used. |
static java.awt.Color |
clear
Default transparent color. |
static boolean |
nativeAlpha
Does this Java version support alpha for java.awt.Colors?. |
Fields inherited from class java.awt.Color |
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW |
Fields inherited from interface java.awt.Transparency |
BITMASK, OPAQUE, TRANSLUCENT |
Constructor Summary | |
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). |
Method Summary | |
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. |
Methods inherited from class java.awt.Color |
brighter, createContext, darker, decode, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getHSBColor, getRGBColorComponents, getRGBComponents, getTransparency, HSBtoRGB, RGBtoHSB |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final transient boolean nativeAlpha
public static final transient java.awt.Color clear
public static final transient java.lang.reflect.Constructor alphaValueConstructor
java.version >= 1.2
.
protected int argb
Constructor Detail |
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)
Method Detail |
public int getRGB()
public void setRGB(int value)
value
- the transparency value between 0-255.public int getRed()
public void setRed(int value)
value
- the red value between 0-255.public int getGreen()
public void setGreen(int value)
value
- the green value between 0-255.public int getBlue()
public void setBlue(int value)
value
- the blue value between 0-255.public int getAlpha()
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 percentange 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 checked
public int hashCode()
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.
obj
- the Color to compare.
public java.lang.String toString()
null
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |