Class WGradient
- java.lang.Object
-
- eu.webtoolkit.jwt.WGradient
-
public class WGradient extends java.lang.ObjectA linear or radial gradient.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWGradient.ColorStopA gradient color stop.
-
Constructor Summary
Constructors Constructor Description WGradient()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddColorStop(double position, WColor color)Adds a color stop.voidaddColorStop(WGradient.ColorStop colorstop)Adds a color stop.voidclearColorStops()Removes all color stops.booleanequals(WGradient other)Indicates whether some other object is "equal to" this one.java.util.List<WGradient.ColorStop>getColorstops()Returns the color stops.WLineFgetLinearGradientVector()Returns the line positioning the linear gradient.WPointFgetRadialCenterPoint()Returns the center of a radial gradient.WPointFgetRadialFocalPoint()Returns the focal point of a radial gradient.doublegetRadialRadius()Returns the radius of a radial gradient.GradientStylegetStyle()Returns the gradient style.booleanisEmpty()Returns whether the gradient is empty.voidsetLinearGradient(double x0, double y0, double x1, double y1)Configures a linear gradient.voidsetRadialGradient(double cx, double cy, double r, double fx, double fy)Configures a radial gradient.
-
-
-
Constructor Detail
-
WGradient
public WGradient()
Default constructor.Creates an empty linear gradient from (0,0) to (1,1) (without color stops).
- See Also:
isEmpty()
-
-
Method Detail
-
getStyle
public GradientStyle 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
public void addColorStop(double position, WColor color)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
public void addColorStop(WGradient.ColorStop colorstop)
Adds a color stop.Adds a color stop.
-
clearColorStops
public void clearColorStops()
Removes all color stops.
-
getColorstops
public java.util.List<WGradient.ColorStop> getColorstops()
Returns the color stops.
-
getLinearGradientVector
public WLineF getLinearGradientVector()
Returns the line positioning the linear gradient.This returns the line set in
setLinearGradient().
-
getRadialCenterPoint
public WPointF getRadialCenterPoint()
Returns the center of a radial gradient.This returns the center point set in
setRadialGradient().
-
getRadialFocalPoint
public WPointF 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
public boolean equals(WGradient other)
Indicates whether some other object is "equal to" this one.
-
-