Wt  4.0.2
Classes | Public Member Functions | Related Functions | List of all members
Wt::WGradient Class Reference

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 WLineFlinearGradientVector () const
 Returns the line positioning the linear gradient. More...
 
const WPointFradialCenterPoint () const
 Returns the center of a radial gradient. More...
 
const WPointFradialFocalPoint () 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.
 

Related Functions

(Note that these are not member functions.)

Detailed Description

A linear or radial gradient.

See also
WPen::setGradient(), WBrush::setGradient()

Constructor & Destructor Documentation

Wt::WGradient::WGradient ( )

Default constructor.

Creates an empty linear gradient from (0,0) to (1,1) (without color stops).

See also
isEmpty()

Member Function Documentation

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::addColorStop ( const ColorStop colorstop)

Adds a color stop.

Adds a color stop.

void Wt::WGradient::clearColorStops ( )

Removes all color stops.

See also
addColorStop()
const std::vector<ColorStop>& Wt::WGradient::colorstops ( ) const

Returns the color stops.

See also
addColorStop()
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.

See also
setLinearGradient(), setRadialGradient()

Generated on Fri Nov 24 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11