java.lang.Object | +--java.awt.GradientPaint
Safe: The GradientPaint class provides a way to fill
a Shape with a linear color gradient pattern.
If Point P1 with Color C1 and Point P2 with
Color C2 are specified in user space, the
Color on the P1, P2 connecting line is proportionally
changed from C1 to C2. Any point P not on the extended P1, P2
connecting line has the color of the point P' that is the perpendicular
projection of P on the extended P1, P2 connecting line.
Points on the extended line outside of the P1, P2 segment can be colored
in one of two ways.
Color C1 while points on the P2 side
have the constant Color C2.
Paint,
Graphics2D.setPaint(java.awt.Paint)GradientPaint(float x1,
float y1,
Color color1,
float x2,
float y2,
Color color2)
GradientPaint object.
GradientPaint(float x1,
float y1,
Color color1,
float x2,
float y2,
Color color2,
boolean cyclic)
GradientPaint
object depending on the boolean parameter.
GradientPaint(java.awt.geom.Point2D pt1,
Color color1,
java.awt.geom.Point2D pt2,
Color color2)
GradientPaint object.
GradientPaint(java.awt.geom.Point2D pt1,
Color color1,
java.awt.geom.Point2D pt2,
Color color2,
boolean cyclic)
GradientPaint
object depending on the boolean parameter.
PaintContext
createContext(java.awt.image.ColorModel cm,
Rectangle deviceBounds,
java.awt.geom.Rectangle2D userBounds,
java.awt.geom.AffineTransform xform,
RenderingHints hints)
java.awt.geom.Point2D
getPoint1()
java.awt.geom.Point2D
getPoint2()
boolean
isCyclic()
true if the gradient cycles repeatedly
between the two colors C1 and C2.
java.awt.geom.Point2D.Float p1
java.awt.geom.Point2D.Float p2
Color color1
Color color2
boolean cyclic
public GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2)
GradientPaint object.
color1 - Color at the first specified
Pointcolor2 - Color at the second specified
Point
NullPointerException - if either one of colors is nullpublic GradientPaint(java.awt.geom.Point2D pt1, Color color1, java.awt.geom.Point2D pt2, Color color2)
GradientPaint object.
pt1 - the first specified Point in user spacecolor1 - Color at the first specified
Pointpt2 - the second specified Point in user spacecolor2 - Color at the second specified
Point
NullPointerException - if either one of colors or points
is nullpublic GradientPaint(float x1, float y1, Color color1, float x2, float y2, Color color2, boolean cyclic)
GradientPaint
object depending on the boolean parameter.
color1 - Color at the first specified
Pointcolor2 - Color at the second specified
Pointcyclic - true if the gradient pattern should cycle
repeatedly between the two colors; false otherwisepublic GradientPaint(java.awt.geom.Point2D pt1, Color color1, java.awt.geom.Point2D pt2, Color color2, boolean cyclic)
GradientPaint
object depending on the boolean parameter.
pt1 - the first specified Point
in user spacecolor1 - Color at the first specified
Pointpt2 - the second specified Point
in user spacecolor2 - Color at the second specified
Pointcyclic - true if the gradient pattern should cycle
repeatedly between the two colors; false otherwise
NullPointerException - if either one of colors or points
is nullpublic java.awt.geom.Point2D getPoint1()
Point2D object that is a copy of the point
that anchors the first color of this
GradientPaint.public Color getColor1()
Color object that is the color
anchored by P1.public java.awt.geom.Point2D getPoint2()
Point2D object that is a copy of the point
that anchors the second color of this
GradientPaint.public Color getColor2()
Color object that is the color
anchored by P2.public boolean isCyclic()
true if the gradient cycles repeatedly
between the two colors C1 and C2.
true if the gradient cycles repeatedly
between the two colors; false otherwise.public PaintContext createContext(java.awt.image.ColorModel cm, Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform xform, RenderingHints hints)
createContext in interface Paintcm - ColorModel that receives
the Paint data. This is used only as a hint.deviceBounds - the device space bounding box of the
graphics primitive being rendereduserBounds - the user space bounding box of the
graphics primitive being renderedxform - the AffineTransform from user
space into device spacehints - the hints that the context object uses to choose
between rendering alternatives
PaintContext that generates color patterns.PaintContextpublic int getTransparency()
GradientPaint.
getTransparency in interface TransparencyGradientPaint
object's transparency mode.Transparency