Paint
, Transparency
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.Constructors
Constructs a simple acyclic GradientPaint
object.
Constructs either a cyclic or acyclic GradientPaint
object depending on the boolean
parameter.
Constructs a simple acyclic GradientPaint
object.
Constructs either a cyclic or acyclic GradientPaint
object depending on the boolean
parameter.
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.
int
Returns the transparency mode for this GradientPaint
.
boolean
Returns true
if the gradient cycles repeatedly between the two colors C1 and C2.
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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
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 the color C1 anchored by the point P1.
Color
object that is the color anchored by P1.
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 color C2 anchored by the point P2.
Color
object that is the color anchored by P2.
public boolean isCyclic()
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.
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.
createContext
in interface Paint
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.
public int getTransparency()
Returns the transparency mode for this GradientPaint
.
getTransparency
in interface Transparency
GradientPaint
object's transparency mode.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4