All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.eou.toolkit.graphics.AlphaColor
java.lang.Object
|
+----java.awt.Color
|
+----com.ibm.eou.toolkit.graphics.AlphaColor
- public class AlphaColor
- extends Color
- implements Serializable
This class provides additional support for holding an alpha channel value in addition to the usual RGB values.
The primary value of this extension is to allow the Fill class (using the ColorGradient class)
to introduce levels of transparency into images.
-
blueberry
- The color blueberry
-
cherry
- The color cherry
-
lemon
- The color lemon
-
lime
- The color lime
-
AlphaColor(Color)
- Create an AlphaColor from the specified Color.
-
AlphaColor(Color, int)
- Create an AlphaColor from the specified Color and alpha value.
-
AlphaColor(float, float, float, float)
- Create an AlphaColor with the specified red, green, blue and alpha values in the range (0.0 - 1.0).
-
AlphaColor(int)
- Create an AlphaColor with the specified combined RGB value consisting of the alpha component in bits 24-31,
the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
-
AlphaColor(int, int, int, int)
- Create an AlphaColor with the specified red, green, blue and alpha values in the range (0 - 255).
-
adjustBrightness(Color, float)
- Return a Color based on a supplied Color with its brightness
adjusted.
-
adjustBrightness(float)
- Return a copy of the AlphaColor with its brightness
adjusted.
-
blend(Color, Color, int)
- Return a color that is a blend of the two supplied colors, with the
supplied bias toward the second color.
-
brighter()
- Return a brighter version of this AlphaColor, preserving the alpha value.
-
combine(Color, AlphaColor)
- Returns the color that would be visible if over was drawn on top
of under.
-
combine(int, int)
- Returns the color that would be visible if over was drawn on top
of under.
-
contrastingColor()
- Return either black or white, whichever contrasts more with this AlphaColor.
-
contrastingColor(Color)
- Return either black or white, whichever contrasts more with the given Color.
-
contrastingColor(Color, int)
- Return either black or white, whichever contrasts more with the given Color.
-
contrastingColor(int)
- Return either black or white, whichever contrasts more with this AlphaColor.
-
copyright()
- Copyright method to ensure that short copyright string appears
in class file.
-
darker()
- Return a darker version of this AlphaColor, preserving the alpha value
-
equals(Object)
- Compares two AlphaColors.
-
findNewColor(Color[])
- Return a color which is guaranteed not to match any of the Colors in the supplied array
-
findNewColor(Vector)
- Return a color which is guaranteed not to match any of the colors in the supplied vector.
-
getAlpha()
- Return the alpha component.
-
getRGBA()
- Return an integer value representing the AlphaColor in the default RGB ColorModel.
-
nearestColor(Color)
- Return the nearest solid color to the supplied color from the current palette.
-
toString()
- Return a String representation of this AlphaColor's values.
lime
public static final Color lime
- The color lime
cherry
public static final Color cherry
- The color cherry
lemon
public static final Color lemon
- The color lemon
blueberry
public static final Color blueberry
- The color blueberry
AlphaColor
public AlphaColor(Color c)
- Create an AlphaColor from the specified Color. The alpha value is set to 255.
- See Also:
- getRGB
AlphaColor
public AlphaColor(Color c,
int alpha)
- Create an AlphaColor from the specified Color and alpha value.
AlphaColor
public AlphaColor(float r,
float g,
float b,
float a)
- Create an AlphaColor with the specified red, green, blue and alpha values in the range (0.0 - 1.0).
AlphaColor
public AlphaColor(int rgba)
- Create an AlphaColor with the specified combined RGB value consisting of the alpha component in bits 24-31,
the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
AlphaColor
public AlphaColor(int r,
int g,
int b,
int a)
- Create an AlphaColor with the specified red, green, blue and alpha values in the range (0 - 255).
copyright
public static String copyright()
- Copyright method to ensure that short copyright string appears
in class file.
blend
public static Color blend(Color color1,
Color color2,
int bias)
- Return a color that is a blend of the two supplied colors, with the
supplied bias toward the second color.
- Parameters:
- color1 - the first of two colors to be blended.
- color2 - the second of two colors to be blended.
- bias - the color bias. 0 will return color1, 100 will return color2,
50 will return an equal blend of color1 and color2.
combine
public static Color combine(Color under,
AlphaColor over)
- Returns the color that would be visible if over was drawn on top
of under.
combine
public static int combine(int under,
int over)
- Returns the color that would be visible if over was drawn on top
of under. The colors used are int RGBA values.
This method is generally faster than the method which uses Colors.
adjustBrightness
public static Color adjustBrightness(Color in,
float adjust)
- Return a Color based on a supplied Color with its brightness
adjusted.
The supplied Color is converted to the HSB colour model and the
brightness value adjusted according to the adjustment parameter.
The adjustment value is a floating point between -1 and 1. A
value of -1 will make the brightness value 0, a value of 1 will
make it 1. Any other positive value adjusts the brightness
upwards by a proportionate amount, whilst a negative value will
adjust the brightness downwards by a proportionate amount.
adjustBrightness
public AlphaColor adjustBrightness(float adjust)
- Return a copy of the AlphaColor with its brightness
adjusted.
The current AlphaColor is converted to the HSB colour model,
ignoring the alpha value, and the
brightness value adjusted according to the adjustment parameter.
The adjustment value is a floating point between -1 and 1. A
value of -1 will make the brightness value 0, a value of 1 will
make it 1. Any other positive value adjusts the brightness
upwards by a proportionate amount, whilst a negative value will
adjust the brightness downwards by a proportionate amount.
brighter
public Color brighter()
- Return a brighter version of this AlphaColor, preserving the alpha value.
- Overrides:
- brighter in class Color
contrastingColor
public Color contrastingColor()
- Return either black or white, whichever contrasts more with this AlphaColor.
contrastingColor
public Color contrastingColor(int threshold)
- Return either black or white, whichever contrasts more with this AlphaColor. The
threshold
is a percentage that specifies the luminance level at which black switches to white with 50 being
half way between the two.
contrastingColor
public static Color contrastingColor(Color c)
- Return either black or white, whichever contrasts more with the given Color.
contrastingColor
public static Color contrastingColor(Color c,
int threshold)
- Return either black or white, whichever contrasts more with the given Color. The
threshold
is a percentage that specifies the luminance level at which black switches to white with 50 being half way.
darker
public Color darker()
- Return a darker version of this AlphaColor, preserving the alpha value
- Overrides:
- darker in class Color
equals
public boolean equals(Object obj)
- Compares two AlphaColors.
Two AlphaColors are considered to be equal if the red, green, blue
and alpha values of both AlphaColors match.
- Overrides:
- equals in class Color
getAlpha
public int getAlpha()
- Return the alpha component.
getRGBA
public int getRGBA()
- Return an integer value representing the AlphaColor in the default RGB ColorModel.
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue).
toString
public String toString()
- Return a String representation of this AlphaColor's values.
- Overrides:
- toString in class Color
findNewColor
public static Color findNewColor(Color testColors[])
- Return a color which is guaranteed not to match any of the Colors in the supplied array
findNewColor
public static synchronized Color findNewColor(Vector testColors)
- Return a color which is guaranteed not to match any of the colors in the supplied vector.
nearestColor
public static Color nearestColor(Color col)
- Return the nearest solid color to the supplied color from the current palette.
All Packages Class Hierarchy This Package Previous Next Index