Class WGradient
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColorStop
(double position, WColor color) Adds a color stop.void
addColorStop
(WGradient.ColorStop colorstop) Adds a color stop.void
Removes all color stops.boolean
Indicates whether some other object is "equal to" this one.Returns the color stops.Returns the line positioning the linear gradient.Returns the center of a radial gradient.Returns the focal point of a radial gradient.double
Returns the radius of a radial gradient.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.
-
Constructor Details
-
WGradient
public WGradient()Default constructor.Creates an empty linear gradient from (0,0) to (1,1) (without color stops).
- See Also:
-
-
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.
-