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

Variable Index

 o charcoal
 o gold
 o gradientDefaults
This is a hashtable which holds the names for canned color gradients.
 o hotAndCold
 o meadow
 o paintPots
 o rainbow
 o terracotta
 o twilight

Constructor Index

 o ColorGradient()
Construct a new empty ColorGradient.
 o ColorGradient(AlphaColor, AlphaColor)
Construct a new ColorGradient with the specified AlphaColors, with both the weights set to 1.
 o ColorGradient(AlphaColor, AlphaColor, int, int)
Construct a new ColorGradient with the specified AlphaColors and weights.
 o ColorGradient(AlphaColor[], AlphaColor[])
Construct a new ColorGradient with the specified AlphaColors, with all the weights set to 1.
 o ColorGradient(AlphaColor[], AlphaColor[], int[], int[])
Construct a new ColorGradient with the specified AlphaColors and weights.
 o ColorGradient(Color, Color)
Construct a new ColorGradient with the specified Colors, with both the weights set to 1.
 o ColorGradient(Color, Color, int, int)
Construct a new ColorGradient with the specified Colors and weights.
 o ColorGradient(Color[], Color[])
Construct a new ColorGradient with the specified Colors, all the weights are set to 1.
 o ColorGradient(Color[], Color[], int[], int[])
Construct a new ColorGradient with the specified Colors and weights.
 o ColorGradient(ColorGradient)
Construct a new ColorGradient from an existing ColorGradient.
 o ColorGradient(ColorGradient[])
Construct a new ColorGradient by concatenating an array of ColorGradients.

Method Index

 o add(AlphaColor, AlphaColor)
Add a color transition to the end of the color gradient.
 o add(AlphaColor, AlphaColor, int, int)
Add a color transition to the end of the color gradient.
 o add(AlphaColor[], AlphaColor[])
Add color transitions to the end of the color gradient.
 o add(AlphaColor[], AlphaColor[], int[], int[])
Add color transitions to the end of the color gradient.
 o add(Color, Color)
Add a color transition to the end of the color gradient.
 o add(Color, Color, int, int)
Add a color transition to the end of the color gradient.
 o add(Color[], Color[])
Add color transitions to the end of the color gradient.
 o add(Color[], Color[], int[], int[])
Add color transitions to the end of the color gradient.
 o add(ColorGradient)
Add a color gradient to the end of this color gradient.
 o add(ColorGradient[])
Add an array of color gradients to the end of this color gradient.
 o copyright()
Copyright method to ensure that short copyright string appears in class file.
 o equals(Object)
Return true if the supplied object equals this
 o getColorArray(int)
Return an array of alpha colors, of the given length, representing the color gradient.
 o 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
 o 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.
 o getTotalWeight()
Calculte the total weighting for the color gradient.
 o isEmpty()
Return true if the total weight is 1 or more
 o reverse()
Return a new color gradient with the order of the colors reversed.

Variables

 o charcoal
 public static final ColorGradient charcoal
 o twilight
 public static final ColorGradient twilight
 o terracotta
 public static final ColorGradient terracotta
 o gold
 public static final ColorGradient gold
 o hotAndCold
 public static final ColorGradient hotAndCold
 o meadow
 public static final ColorGradient meadow
 o rainbow
 public static final ColorGradient rainbow
 o paintPots
 public static final ColorGradient paintPots
 o gradientDefaults
 public static final Hashtable gradientDefaults
This is a hashtable which holds the names for canned color gradients.

See Also:
getGradientDefaults

Constructors

 o ColorGradient
 public ColorGradient()
Construct a new empty ColorGradient. Color transitions must be added to it before it can be used.

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

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

 o ColorGradient
 public ColorGradient(AlphaColor startColor,
                      AlphaColor endColor)
Construct a new ColorGradient with the specified AlphaColors, with both the weights set to 1.

 o ColorGradient
 public ColorGradient(Color startColor,
                      Color endColor)
Construct a new ColorGradient with the specified Colors, with both the weights set to 1.

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

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

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

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

 o ColorGradient
 public ColorGradient(ColorGradient colorGradients[])
Construct a new ColorGradient by concatenating an array of ColorGradients.

 o ColorGradient
 public ColorGradient(ColorGradient colorGradient)
Construct a new ColorGradient from an existing ColorGradient.

Methods

 o 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
 o 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
 o copyright
 public static String copyright()
Copyright method to ensure that short copyright string appears in class file.

 o add
 public void add(AlphaColor startColor,
                 AlphaColor endColor,
                 int startWeight,
                 int endWeight)
Add a color transition to the end of the color gradient.

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

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

 o add
 public void add(Color startColor,
                 Color endColor,
                 int startWeight,
                 int endWeight)
Add a color transition to the end of the color gradient.

 o add
 public void add(AlphaColor startColors[],
                 AlphaColor endColors[],
                 int startWeights[],
                 int endWeights[])
Add color transitions to the end of the color gradient.

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

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

 o add
 public void add(Color startColors[],
                 Color endColors[],
                 int startWeights[],
                 int endWeights[])
Add color transitions to the end of the color gradient.

 o add
 public void add(ColorGradient colorGradients[])
Add an array of color gradients to the end of this color gradient.

 o add
 public void add(ColorGradient colorGradient)
Add a color gradient to the end of this color gradient.

 o getColorArray
 public synchronized AlphaColor[] getColorArray(int numberOfElements)
Return an array of alpha colors, of the given length, representing the color gradient.

 o reverse
 public synchronized ColorGradient reverse()
Return a new color gradient with the order of the colors reversed.

 o getTotalWeight
 public int getTotalWeight()
Calculte the total weighting for the color gradient. This is the sum of all the before and after weightings.

 o isEmpty
 public boolean isEmpty()
Return true if the total weight is 1 or more

 o 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