Wt
4.11.1
|
A linear or radial gradient. More...
#include <Wt/WGradient.h>
Classes | |
class | ColorStop |
A gradient color stop. More... | |
Public Member Functions | |
WGradient () | |
Default constructor. More... | |
GradientStyle | style () const |
Returns the gradient style. More... | |
bool | isEmpty () const |
Returns whether the gradient is empty. More... | |
void | setLinearGradient (double x0, double y0, double x1, double y1) |
Configures a linear gradient. More... | |
void | setRadialGradient (double cx, double cy, double r, double fx, double fy) |
Configures a radial gradient. More... | |
void | addColorStop (double position, const WColor &color) |
Adds a color stop. More... | |
void | addColorStop (const ColorStop &colorstop) |
Adds a color stop. More... | |
void | clearColorStops () |
Removes all color stops. More... | |
const std::vector< ColorStop > & | colorstops () const |
Returns the color stops. More... | |
const WLineF & | linearGradientVector () const |
Returns the line positioning the linear gradient. More... | |
const WPointF & | radialCenterPoint () const |
Returns the center of a radial gradient. More... | |
const WPointF & | radialFocalPoint () const |
Returns the focal point of a radial gradient. More... | |
double | radialRadius () const |
Returns the radius of a radial gradient. More... | |
bool | operator== (const WGradient &other) const |
Comparison operator. | |
bool | operator!= (const WGradient &other) const |
Comparison operator. | |
A linear or radial gradient.
Wt::WGradient::WGradient | ( | ) |
Default constructor.
Creates an empty linear gradient from (0,0) to (1,1) (without color stops).
void Wt::WGradient::addColorStop | ( | const ColorStop & | colorstop | ) |
Adds a color stop.
Adds a color stop.
void Wt::WGradient::addColorStop | ( | double | position, |
const 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).
void Wt::WGradient::clearColorStops | ( | ) |
Removes all color stops.
const std::vector<ColorStop>& Wt::WGradient::colorstops | ( | ) | const |
Returns the color stops.
bool Wt::WGradient::isEmpty | ( | ) | const |
Returns whether the gradient is empty.
A gradient is empty if no color stops are defined.
const WLineF& Wt::WGradient::linearGradientVector | ( | ) | const |
Returns the line positioning the linear gradient.
This returns the line set in setLinearGradient().
const WPointF& Wt::WGradient::radialCenterPoint | ( | ) | const |
Returns the center of a radial gradient.
This returns the center point set in setRadialGradient().
const WPointF& Wt::WGradient::radialFocalPoint | ( | ) | const |
Returns the focal point of a radial gradient.
This returns the focal point set in setRadialGradient().
double Wt::WGradient::radialRadius | ( | ) | const |
Returns the radius of a radial gradient.
This returns the radius set in setRadialGradient().
void Wt::WGradient::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.
void Wt::WGradient::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.
GradientStyle Wt::WGradient::style | ( | ) | const |
Returns the gradient style.