com.mindfusion.diagramming
Class GradientBrush

java.lang.Object
  extended by com.mindfusion.diagramming.Brush
      extended by com.mindfusion.diagramming.GradientBrush
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class GradientBrush
extends Brush

Represents a gradient brush which paints the interior of objects starting with one color and gradually changing to another color by interpolating the RGB values of the two colors.

See Also:
Serialized Form

Constructor Summary
GradientBrush()
          Initializes a new instance of the GradientBrush class.
GradientBrush(java.awt.Color color1, java.awt.Color color2, int angle)
          Initializes a new instance of the GradientBrush class.
GradientBrush(float[] fractions, java.awt.Color[] colors, int angle)
          Initializes a new instance of the GradientBrush class.
 
Method Summary
 void applyTo(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
           
 java.lang.Object clone()
          Creates a clone of the brush.
 int getAngle()
          Gets the gradient orientation angle.
 java.awt.Color getColor1()
          Gets the first gradient color.
 java.awt.Color getColor2()
          Gets the second gradient color.
 java.awt.Color[] getColors()
           
 float[] getFractions()
           
 void readExternal(java.io.ObjectInput in)
          Implements Externalizable.
 void setColor1(java.awt.Color value)
          Sets the first gradient color.
 void setColor2(java.awt.Color value)
          Sets the second gradient color.
 void setColors(java.awt.Color[] value)
           
 void setFractions(float[] value)
           
 void writeExternal(java.io.ObjectOutput out)
          Implements Externalizable.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GradientBrush

public GradientBrush(java.awt.Color color1,
                     java.awt.Color color2,
                     int angle)
Initializes a new instance of the GradientBrush class.

Parameters:
color1 - A Color object representing the start color of the gradient.
color2 - A Color object representing the end color of the gradient.
angle - An integer value specifying the gradient orientation.

GradientBrush

public GradientBrush(float[] fractions,
                     java.awt.Color[] colors,
                     int angle)
Initializes a new instance of the GradientBrush class. Instances of the GradientBrush class created using this constructor are currently not serialized.

Parameters:
fractions - An array of float numbers specifying the positions of the colors along the gradient.
colors - An array of Color objects representing the colors of the gradient.
angle - An integer value specifying the gradient orientation.

GradientBrush

public GradientBrush()
Initializes a new instance of the GradientBrush class.

Method Detail

applyTo

public void applyTo(java.awt.Graphics2D g,
                    java.awt.geom.Rectangle2D bounds)
Specified by:
applyTo in class Brush

clone

public java.lang.Object clone()
Creates a clone of the brush.

Overrides:
clone in class Brush
Returns:
A GradientBrush instance.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Implements Externalizable.

Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Implements Externalizable.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

getColor1

public java.awt.Color getColor1()
Gets the first gradient color.

Returns:
A Color object representing the fill color.

setColor1

public void setColor1(java.awt.Color value)
Sets the first gradient color.

Parameters:
value - A Color object representing the fill color.

getColor2

public java.awt.Color getColor2()
Gets the second gradient color.

Returns:
A Color object representing the fill color.

setColor2

public void setColor2(java.awt.Color value)
Sets the second gradient color.

Parameters:
value - A Color object representing the fill color.

getAngle

public int getAngle()
Gets the gradient orientation angle.

Returns:
A float value specifying the gradient angle.

getFractions

public float[] getFractions()

setFractions

public void setFractions(float[] value)

getColors

public java.awt.Color[] getColors()

setColors

public void setColors(java.awt.Color[] value)