All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.eou.toolkit.graphics.ColorGradient
java.lang.Object
|
+----com.ibm.eou.toolkit.graphics.ColorGradient
- public class ColorGradient
- extends Object
- implements Serializable
This class is used to define a color gradient which may be used as input to subsequent gradient
filled image generation methods on the Fill class. It is a list of weighted color pairs for each color transition
in the gradient. The weighting is a non-negative integer that influences the proportion of the total
gradient that is affected by the associated color. If we construct a color gradient with a start weight of
2 and an end weight of 1, the mid point of transition between the start and end colors would occur two thirds
of the way along the total color gradient.
- See Also:
- Fill
-
charcoal
-
-
gold
-
-
gradientDefaults
- This is a hashtable which holds the names for canned color gradients.
-
hotAndCold
-
-
meadow
-
-
paintPots
-
-
rainbow
-
-
terracotta
-
-
twilight
-
-
ColorGradient()
- Construct a new empty ColorGradient.
-
ColorGradient(AlphaColor, AlphaColor)
- Construct a new ColorGradient with the specified AlphaColors, with both the weights set to 1.
-
ColorGradient(AlphaColor, AlphaColor, int, int)
- Construct a new ColorGradient with the specified AlphaColors and weights.
-
ColorGradient(AlphaColor[], AlphaColor[])
- Construct a new ColorGradient with the specified AlphaColors, with all the weights set to 1.
-
ColorGradient(AlphaColor[], AlphaColor[], int[], int[])
- Construct a new ColorGradient with the specified AlphaColors and weights.
-
ColorGradient(Color, Color)
- Construct a new ColorGradient with the specified Colors, with both the weights set to 1.
-
ColorGradient(Color, Color, int, int)
- Construct a new ColorGradient with the specified Colors and weights.
-
ColorGradient(Color[], Color[])
- Construct a new ColorGradient with the specified Colors, all the weights are set to 1.
-
ColorGradient(Color[], Color[], int[], int[])
- Construct a new ColorGradient with the specified Colors and weights.
-
ColorGradient(ColorGradient)
- Construct a new ColorGradient from an existing ColorGradient.
-
ColorGradient(ColorGradient[])
- Construct a new ColorGradient by concatenating an array of ColorGradients.
-
add(AlphaColor, AlphaColor)
- Add a color transition to the end of the color gradient.
-
add(AlphaColor, AlphaColor, int, int)
- Add a color transition to the end of the color gradient.
-
add(AlphaColor[], AlphaColor[])
- Add color transitions to the end of the color gradient.
-
add(AlphaColor[], AlphaColor[], int[], int[])
- Add color transitions to the end of the color gradient.
-
add(Color, Color)
- Add a color transition to the end of the color gradient.
-
add(Color, Color, int, int)
- Add a color transition to the end of the color gradient.
-
add(Color[], Color[])
- Add color transitions to the end of the color gradient.
-
add(Color[], Color[], int[], int[])
- Add color transitions to the end of the color gradient.
-
add(ColorGradient)
- Add a color gradient to the end of this color gradient.
-
add(ColorGradient[])
- Add an array of color gradients to the end of this color gradient.
-
copyright()
- Copyright method to ensure that short copyright string appears
in class file.
-
equals(Object)
- Return true if the supplied object equals this
-
getColorArray(int)
- Return an array of alpha colors, of the given length, representing the color gradient.
-
getGradientDefaultKeys(boolean)
- This method returns an array of keys relating to each of the color gradients which can then be
used to access strings in a properties file
-
getGradientDefaults(boolean)
- This method is for returning the names of available predefined gradients
in a more useful form for programmers than the Enumeration available from
the Hashtable.
-
getTotalWeight()
- Calculte the total weighting for the color gradient.
-
isEmpty()
- Return true if the total weight is 1 or more
-
reverse()
- Return a new color gradient with the order of the colors reversed.
charcoal
public static final ColorGradient charcoal
twilight
public static final ColorGradient twilight
terracotta
public static final ColorGradient terracotta
gold
public static final ColorGradient gold
hotAndCold
public static final ColorGradient hotAndCold
meadow
public static final ColorGradient meadow
rainbow
public static final ColorGradient rainbow
paintPots
public static final ColorGradient paintPots
gradientDefaults
public static final Hashtable gradientDefaults
- This is a hashtable which holds the names for canned color gradients.
- See Also:
- getGradientDefaults
ColorGradient
public ColorGradient()
- Construct a new empty ColorGradient. Color transitions must be added to it before it can be used.
ColorGradient
public ColorGradient(AlphaColor startColor,
AlphaColor endColor,
int startWeight,
int endWeight)
- Construct a new ColorGradient with the specified AlphaColors and weights.
If either of the weights are less than zero they are assumed to be zero.
ColorGradient
public ColorGradient(Color startColor,
Color endColor,
int startWeight,
int endWeight)
- Construct a new ColorGradient with the specified Colors and weights.
If either of the weights are less than zero they are assumed to be zero.
ColorGradient
public ColorGradient(AlphaColor startColor,
AlphaColor endColor)
- Construct a new ColorGradient with the specified AlphaColors, with both the weights set to 1.
ColorGradient
public ColorGradient(Color startColor,
Color endColor)
- Construct a new ColorGradient with the specified Colors, with both the weights set to 1.
ColorGradient
public ColorGradient(AlphaColor startColors[],
AlphaColor endColors[],
int startWeights[],
int endWeights[])
- Construct a new ColorGradient with the specified AlphaColors and weights.
If the arrays of colors are not the same length then the longer one is cropped to the
length of the shorter one. If either of the weightings arrays is longer than the color arrays
then they are cropped to the length of the color arrays. If either of the weightings arrays
is too short then they are padded out with 1's to the appropriate length.
ColorGradient
public ColorGradient(Color startColors[],
Color endColors[],
int startWeights[],
int endWeights[])
- Construct a new ColorGradient with the specified Colors and weights.
If the arrays of colors are not the same length then the longer one is cropped to the
length of the shorter one. If either of the weightings arrays is longer than the color arrays
then they are cropped to the length of the color arrays. If either of the weightings arrays
is too short then they are padded out with 1's to the appropriate length.
ColorGradient
public ColorGradient(AlphaColor startColors[],
AlphaColor endColors[])
- Construct a new ColorGradient with the specified AlphaColors, with all the weights set to 1.
If the arrays of colors are not the same length then the longer one is cropped to the
length of the shorter one.
ColorGradient
public ColorGradient(Color startColors[],
Color endColors[])
- Construct a new ColorGradient with the specified Colors, all the weights are set to 1.
If the arrays of colors are not the same length then the longer one is cropped to the
length of the shorter one.
ColorGradient
public ColorGradient(ColorGradient colorGradients[])
- Construct a new ColorGradient by concatenating an array of ColorGradients.
ColorGradient
public ColorGradient(ColorGradient colorGradient)
- Construct a new ColorGradient from an existing ColorGradient.
getGradientDefaults
public static String[] getGradientDefaults(boolean includeNull)
- This method is for returning the names of available predefined gradients
in a more useful form for programmers than the Enumeration available from
the Hashtable.
- Returns:
- An array of strings that are the keys in gradientDefaults
- See Also:
- gradientDefaults
getGradientDefaultKeys
public static String[] getGradientDefaultKeys(boolean includeNull)
- This method returns an array of keys relating to each of the color gradients which can then be
used to access strings in a properties file
- Returns:
- An array of keys for the color gradients
copyright
public static String copyright()
- Copyright method to ensure that short copyright string appears
in class file.
add
public void add(AlphaColor startColor,
AlphaColor endColor,
int startWeight,
int endWeight)
- Add a color transition to the end of the color gradient.
add
public void add(AlphaColor startColor,
AlphaColor endColor)
- Add a color transition to the end of the color gradient.
The weights are assumed to be 1.
add
public void add(Color startColor,
Color endColor)
- Add a color transition to the end of the color gradient.
The weights are assumed to be 1.
add
public void add(Color startColor,
Color endColor,
int startWeight,
int endWeight)
- Add a color transition to the end of the color gradient.
add
public void add(AlphaColor startColors[],
AlphaColor endColors[],
int startWeights[],
int endWeights[])
- Add color transitions to the end of the color gradient.
add
public void add(AlphaColor startColors[],
AlphaColor endColors[])
- Add color transitions to the end of the color gradient.
The weights are assumed to be 1.
add
public void add(Color startColors[],
Color endColors[])
- Add color transitions to the end of the color gradient.
The weights are assumed to be 1.
add
public void add(Color startColors[],
Color endColors[],
int startWeights[],
int endWeights[])
- Add color transitions to the end of the color gradient.
add
public void add(ColorGradient colorGradients[])
- Add an array of color gradients to the end of this color gradient.
add
public void add(ColorGradient colorGradient)
- Add a color gradient to the end of this color gradient.
getColorArray
public synchronized AlphaColor[] getColorArray(int numberOfElements)
- Return an array of alpha colors, of the given length, representing the color gradient.
reverse
public synchronized ColorGradient reverse()
- Return a new color gradient with the order of the colors reversed.
getTotalWeight
public int getTotalWeight()
- Calculte the total weighting for the color gradient.
This is the sum of all the before and after weightings.
isEmpty
public boolean isEmpty()
- Return true if the total weight is 1 or more
equals
public boolean equals(Object newobject)
- Return true if the supplied object equals this
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index