Class WGradient
public class WGradient
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WGradient.ColorStop
A gradient color stop. -
Constructor Summary
Constructors Constructor Description WGradient()
Default constructor. -
Method Summary
Modifier and Type Method Description void
addColorStop(double position, WColor color)
Adds a color stop.void
addColorStop(WGradient.ColorStop colorstop)
Adds a color stop.void
clearColorStops()
Removes all color stops.boolean
equals(WGradient other)
Indicates whether some other object is "equal to" this one.java.util.List<WGradient.ColorStop>
getColorstops()
Returns the color stops.WLineF
getLinearGradientVector()
Returns the line positioning the linear gradient.WPointF
getRadialCenterPoint()
Returns the center of a radial gradient.WPointF
getRadialFocalPoint()
Returns the focal point of a radial gradient.double
getRadialRadius()
Returns the radius of a radial gradient.GradientStyle
getStyle()
Returns the gradient style.boolean
isEmpty()
Returns whether the gradient is empty.void
setLinearGradient(double x0, double y0, double x1, double y1)
Configures a linear gradient.void
setRadialGradient(double cx, double cy, double r, double fx, double fy)
Configures a radial gradient.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
WGradient
public WGradient()Default constructor.Creates an empty linear gradient from (0,0) to (1,1) (without color stops).
- See Also:
isEmpty()
-
-
Method Details
-
getStyle
Returns the gradient style. -
isEmpty
public boolean isEmpty()Returns whether the gradient is empty.A gradient is empty if no color stops are defined.
-
setLinearGradient
public void setLinearGradient(double x0, double y0, double x1, double y1)Configures a linear gradient.The coordinates describe a line which provides an origin and orientation of the gradient in user-space coordinates.
-
setRadialGradient
public void setRadialGradient(double cx, double cy, double r, double fx, double fy)Configures a radial gradient.A radial gradient is described by a center, a radial and a focus point. All coordinates are user-space coordinates.
-
addColorStop
Adds a color stop.For a linear gradient, the position is relative to the position on the line (from 0 to 1 corresponding to p0 to p1).
For a radial gradient, the position indicates the distance from the center (from 0 to 1 corresponding to center to radius).
-
addColorStop
Adds a color stop.Adds a color stop.
-
clearColorStops
public void clearColorStops()Removes all color stops. -
getColorstops
Returns the color stops. -
getLinearGradientVector
Returns the line positioning the linear gradient.This returns the line set in
setLinearGradient()
. -
getRadialCenterPoint
Returns the center of a radial gradient.This returns the center point set in
setRadialGradient()
. -
getRadialFocalPoint
Returns the focal point of a radial gradient.This returns the focal point set in
setRadialGradient()
. -
getRadialRadius
public double getRadialRadius()Returns the radius of a radial gradient.This returns the radius set in
setRadialGradient()
. -
equals
Indicates whether some other object is "equal to" this one.
-