public class GradientBrush extends Brush
Constructor and Description |
---|
GradientBrush()
Initializes a new instance of the
GradientBrush class. |
GradientBrush(boolean extended)
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. |
GradientBrush(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
java.awt.Color color1,
java.awt.Color color2)
Initializes a new instance of the
GradientBrush class. |
Modifier and Type | Method and Description |
---|---|
void |
applyTo(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D bounds)
Applies the brush to the specified graphics.
|
GradientBrush |
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() |
java.awt.MultipleGradientPaint.CycleMethod |
getCycleMethod() |
java.awt.geom.Point2D |
getEnd() |
float[] |
getFractions() |
java.awt.geom.Point2D |
getStart() |
java.awt.geom.AffineTransform |
getTransform() |
boolean |
isX1Percent() |
boolean |
isX2Percent() |
boolean |
isY1Percent() |
boolean |
isY2Percent() |
void |
readExternal(java.io.ObjectInput in)
Implements Externalizable.
|
void |
setAngle(int angle)
Sets the gradient orientation angle.
|
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 |
setCycleMethod(java.awt.MultipleGradientPaint.CycleMethod value) |
void |
setEnd(java.awt.geom.Point2D end) |
void |
setFractions(float[] value) |
void |
setPercentX1(boolean value) |
void |
setPercentX2(boolean value) |
void |
setPercentY1(boolean value) |
void |
setPercentY2(boolean value) |
void |
setStart(java.awt.geom.Point2D start) |
void |
setTransform(java.awt.geom.AffineTransform value) |
java.awt.Color |
toColor()
Returns a single color approximation of the brush.
|
void |
writeExternal(java.io.ObjectOutput out)
Implements Externalizable.
|
public GradientBrush(java.awt.Color color1, java.awt.Color color2, int angle)
GradientBrush
class.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.public GradientBrush(float[] fractions, java.awt.Color[] colors, int angle)
GradientBrush
class.
Instances of the GradientBrush
class created using this constructor are currently not serialized.
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.public GradientBrush(java.awt.geom.Point2D start, java.awt.geom.Point2D end, java.awt.Color color1, java.awt.Color color2)
GradientBrush
class.start
- the gradient axis start Point2D
in user spaceend
- the gradient axis end Point2D
in user spacecolor1
- A Color object representing the start color of the gradient.color2
- A Color object representing the end color of the gradient.public GradientBrush()
GradientBrush
class.public GradientBrush(boolean extended)
GradientBrush
class.extended
- turns on the extended brush mode for drawing svgpublic void applyTo(java.awt.Graphics2D g, java.awt.geom.Rectangle2D bounds)
public GradientBrush clone()
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public java.awt.Color getColor1()
public void setColor1(java.awt.Color value)
value
- A Color object representing the fill color.public java.awt.Color getColor2()
public void setColor2(java.awt.Color value)
value
- A Color object representing the fill color.public int getAngle()
public void setAngle(int angle)
angle
- A float value specifying the gradient angle.public float[] getFractions()
public void setFractions(float[] value)
public java.awt.Color[] getColors()
public void setColors(java.awt.Color[] value)
public void setTransform(java.awt.geom.AffineTransform value)
public java.awt.geom.AffineTransform getTransform()
public void setStart(java.awt.geom.Point2D start)
public java.awt.geom.Point2D getStart()
public void setEnd(java.awt.geom.Point2D end)
public java.awt.geom.Point2D getEnd()
public java.awt.Color toColor()
Brush
public void setCycleMethod(java.awt.MultipleGradientPaint.CycleMethod value)
public java.awt.MultipleGradientPaint.CycleMethod getCycleMethod()
public void setPercentX1(boolean value)
public void setPercentY1(boolean value)
public void setPercentX2(boolean value)
public void setPercentY2(boolean value)
public boolean isX1Percent()
public boolean isX2Percent()
public boolean isY1Percent()
public boolean isY2Percent()