java.lang.Object | |
↳ | java.awt.GradientPaint |
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.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a simple acyclic
GradientPaint object. | |||||||||||
Constructs a simple acyclic
GradientPaint object. | |||||||||||
Constructs either a cyclic or acyclic
GradientPaint
object depending on the boolean parameter. | |||||||||||
Constructs either a cyclic or acyclic
GradientPaint
object depending on the boolean parameter. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates and returns a
PaintContext used to
generate a linear color gradient pattern. | |||||||||||
Returns the color C1 anchored by the point P1.
| |||||||||||
Returns the color C2 anchored by the point P2.
| |||||||||||
Returns a copy of the point P1 that anchors the first color.
| |||||||||||
Returns a copy of the point P2 which anchors the second color.
| |||||||||||
Returns the transparency mode for this
GradientPaint . | |||||||||||
Returns
true if the gradient cycles repeatedly
between the two colors C1 and C2. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructs a simple acyclic GradientPaint
object.
x1 | x coordinate of the first specified
Point in user space |
---|---|
y1 | y coordinate of the first specified
Point in user space |
color1 | Color at the first specified
Point |
x2 | x coordinate of the second specified
Point in user space |
y2 | y coordinate of the second specified
Point in user space |
color2 | Color at the second specified
Point |
NullPointerException | if either one of colors is null |
---|
Constructs a simple acyclic GradientPaint
object.
pt1 | the first specified Point in user space |
---|---|
color1 | Color at the first specified
Point |
pt2 | the second specified Point in user space |
color2 | Color at the second specified
Point |
NullPointerException | if either one of colors or points is null |
---|
Constructs either a cyclic or acyclic GradientPaint
object depending on the boolean
parameter.
x1 | x coordinate of the first specified
Point in user space |
---|---|
y1 | y coordinate of the first specified
Point in user space |
color1 | Color at the first specified
Point |
x2 | x coordinate of the second specified
Point in user space |
y2 | y coordinate of the second specified
Point in user space |
color2 | Color at the second specified
Point |
cyclic | true if the gradient pattern should cycle
repeatedly between the two colors; false otherwise
|
Constructs either a cyclic or acyclic GradientPaint
object depending on the boolean
parameter.
pt1 | the first specified Point
in user space |
---|---|
color1 | Color at the first specified
Point |
pt2 | the second specified Point
in user space |
color2 | Color at the second specified
Point |
cyclic | true if the gradient pattern should cycle
repeatedly between the two colors; false otherwise |
NullPointerException | if either one of colors or points is null |
---|
Creates and returns a PaintContext
used to
generate a linear color gradient pattern.
See the specification
of the
method in the Paint
interface for information
on null parameter handling.
cm | the preferred ColorModel which represents the most convenient
format for the caller to receive the pixel data, or null
if there is no preference. |
---|---|
deviceBounds | the device space bounding box of the graphics primitive being rendered. |
userBounds | the user space bounding box of the graphics primitive being rendered. |
xform | the AffineTransform from user
space into device space. |
hints | the set of hints that the context object can use to choose between rendering alternatives. |
PaintContext
for
generating color patterns.Returns the color C1 anchored by the point P1.
Color
object that is the color
anchored by P1.
Returns the color C2 anchored by the point P2.
Color
object that is the color
anchored by P2.
Returns a copy of the point P1 that anchors the first color.
Point2D
object that is a copy of the point
that anchors the first color of this
GradientPaint
.
Returns a copy of the point P2 which anchors the second color.
Point2D
object that is a copy of the point
that anchors the second color of this
GradientPaint
.
Returns the transparency mode for this GradientPaint
.
GradientPaint
object's transparency mode.Returns 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.