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.


Variable Index

 o blueberry
The color blueberry
 o cherry
The color cherry
 o lemon
The color lemon
 o lime
The color lime

Constructor Index

 o AlphaColor(Color)
Create an AlphaColor from the specified Color.
 o AlphaColor(Color, int)
Create an AlphaColor from the specified Color and alpha value.
 o AlphaColor(float, float, float, float)
Create an AlphaColor with the specified red, green, blue and alpha values in the range (0.0 - 1.0).
 o 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.
 o AlphaColor(int, int, int, int)
Create an AlphaColor with the specified red, green, blue and alpha values in the range (0 - 255).

Method Index

 o adjustBrightness(Color, float)
Return a Color based on a supplied Color with its brightness adjusted.
 o adjustBrightness(float)
Return a copy of the AlphaColor with its brightness adjusted.
 o blend(Color, Color, int)
Return a color that is a blend of the two supplied colors, with the supplied bias toward the second color.
 o brighter()
Return a brighter version of this AlphaColor, preserving the alpha value.
 o combine(Color, AlphaColor)
Returns the color that would be visible if over was drawn on top of under.
 o combine(int, int)
Returns the color that would be visible if over was drawn on top of under.
 o contrastingColor()
Return either black or white, whichever contrasts more with this AlphaColor.
 o contrastingColor(Color)
Return either black or white, whichever contrasts more with the given Color.
 o contrastingColor(Color, int)
Return either black or white, whichever contrasts more with the given Color.
 o contrastingColor(int)
Return either black or white, whichever contrasts more with this AlphaColor.
 o copyright()
Copyright method to ensure that short copyright string appears in class file.
 o darker()
Return a darker version of this AlphaColor, preserving the alpha value
 o equals(Object)
Compares two AlphaColors.
 o findNewColor(Color[])
Return a color which is guaranteed not to match any of the Colors in the supplied array
 o findNewColor(Vector)
Return a color which is guaranteed not to match any of the colors in the supplied vector.
 o getAlpha()
Return the alpha component.
 o getRGBA()
Return an integer value representing the AlphaColor in the default RGB ColorModel.
 o nearestColor(Color)
Return the nearest solid color to the supplied color from the current palette.
 o toString()
Return a String representation of this AlphaColor's values.

Variables

 o lime
 public static final Color lime
The color lime

 o cherry
 public static final Color cherry
The color cherry

 o lemon
 public static final Color lemon
The color lemon

 o blueberry
 public static final Color blueberry
The color blueberry

Constructors

 o AlphaColor
 public AlphaColor(Color c)
Create an AlphaColor from the specified Color. The alpha value is set to 255.

See Also:
getRGB
 o AlphaColor
 public AlphaColor(Color c,
                   int alpha)
Create an AlphaColor from the specified Color and alpha value.

 o 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).

 o 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.

 o 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).

Methods

 o copyright
 public static String copyright()
Copyright method to ensure that short copyright string appears in class file.

 o 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.
 o combine
 public static Color combine(Color under,
                             AlphaColor over)
Returns the color that would be visible if over was drawn on top of under.

 o 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.

 o 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.

 o 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.

 o brighter
 public Color brighter()
Return a brighter version of this AlphaColor, preserving the alpha value.

Overrides:
brighter in class Color
 o contrastingColor
 public Color contrastingColor()
Return either black or white, whichever contrasts more with this AlphaColor.

 o 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.

 o contrastingColor
 public static Color contrastingColor(Color c)
Return either black or white, whichever contrasts more with the given Color.

 o 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.

 o darker
 public Color darker()
Return a darker version of this AlphaColor, preserving the alpha value

Overrides:
darker in class Color
 o 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
 o getAlpha
 public int getAlpha()
Return the alpha component.

 o 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).

 o toString
 public String toString()
Return a String representation of this AlphaColor's values.

Overrides:
toString in class Color
 o findNewColor
 public static Color findNewColor(Color testColors[])
Return a color which is guaranteed not to match any of the Colors in the supplied array

 o 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.

 o 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