Qt 4.8
|
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush. More...
#include <qbrush.h>
Public Functions | |
QPointF | center () const |
Returns the center of this radial gradient in logical coordinates. More... | |
qreal | centerRadius () const |
Returns the center radius of this radial gradient in logical coordinates. More... | |
QPointF | focalPoint () const |
Returns the focal point of this radial gradient in logical coordinates. More... | |
qreal | focalRadius () const |
Returns the focal radius of this radial gradient in logical coordinates. More... | |
QRadialGradient () | |
Constructs a simple radial gradient with the center and focal point at (0, 0) with a radius of 1. More... | |
QRadialGradient (const QPointF ¢er, qreal radius, const QPointF &focalPoint) | |
Constructs a simple radial gradient with the given center, radius and focalPoint. More... | |
QRadialGradient (qreal cx, qreal cy, qreal radius, qreal fx, qreal fy) | |
Constructs a simple radial gradient with the given center (cx, cy), radius and focal point (fx, fy). More... | |
QRadialGradient (const QPointF ¢er, qreal radius) | |
Constructs a simple radial gradient with the given center, radius and the focal point in the circle center. More... | |
QRadialGradient (qreal cx, qreal cy, qreal radius) | |
Constructs a simple radial gradient with the center at (cx, cy) and the specified radius. More... | |
QRadialGradient (const QPointF ¢er, qreal centerRadius, const QPointF &focalPoint, qreal focalRadius) | |
Constructs an extended radial gradient with the given center, centerRadius, focalPoint, and focalRadius. More... | |
QRadialGradient (qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius) | |
Constructs an extended radial gradient with the given center (cx, cy), center radius, centerRadius, focal point, (fx, fy), and focal radius focalRadius. More... | |
qreal | radius () const |
Returns the radius of this radial gradient in logical coordinates. More... | |
void | setCenter (const QPointF ¢er) |
Sets the center of this radial gradient in logical coordinates to center. More... | |
void | setCenter (qreal x, qreal y) |
Sets the center of this radial gradient in logical coordinates to (x, y). More... | |
void | setCenterRadius (qreal radius) |
void | setFocalPoint (const QPointF &focalPoint) |
Sets the focal point of this radial gradient in logical coordinates to focalPoint. More... | |
void | setFocalPoint (qreal x, qreal y) |
Sets the focal point of this radial gradient in logical coordinates to (x, y). More... | |
void | setFocalRadius (qreal radius) |
void | setRadius (qreal radius) |
Public Functions inherited from QGradient | |
CoordinateMode | coordinateMode () const |
Returns the coordinate mode of this gradient. More... | |
InterpolationMode | interpolationMode () const |
Returns the interpolation mode of this gradient. More... | |
bool | operator!= (const QGradient &other) const |
Returns true if the gradient is the same as the other gradient specified; otherwise returns false. More... | |
bool | operator== (const QGradient &gradient) const |
Returns true if the gradient is the same as the other gradient specified; otherwise returns false. More... | |
bool | operator== (const QGradient &gradient) |
QGradient () | |
void | setColorAt (qreal pos, const QColor &color) |
Creates a stop point at the given position with the given color. More... | |
void | setCoordinateMode (CoordinateMode mode) |
Sets the coordinate mode of this gradient to mode. More... | |
void | setInterpolationMode (InterpolationMode mode) |
Sets the interpolation mode of this gradient to mode. More... | |
void | setSpread (Spread spread) |
Specifies the spread method that should be used for this gradient. More... | |
void | setStops (const QGradientStops &stops) |
Replaces the current set of stop points with the given stopPoints. More... | |
Spread | spread () const |
Returns the spread method use by this gradient. More... | |
QGradientStops | stops () const |
Returns the stop points for this gradient. More... | |
Type | type () const |
Returns the type of gradient. More... | |
Additional Inherited Members | |
Public Types inherited from QGradient | |
enum | CoordinateMode { LogicalMode, StretchToDeviceMode, ObjectBoundingMode } |
This enum specifies how gradient coordinates map to the paint device on which the gradient is used. More... | |
enum | InterpolationMode { ColorInterpolation, ComponentInterpolation } |
enum | Spread { PadSpread, ReflectSpread, RepeatSpread } |
Specifies how the area outside the gradient area should be filled. More... | |
enum | Type { LinearGradient, RadialGradient, ConicalGradient, NoGradient } |
Specifies the type of gradient. More... | |
Related Functions inherited from QGradient | |
QGradientStop | |
Typedef for QPair<qreal , QColor>. More... | |
QGradientStops | |
Typedef for QVector<QGradientStop>. More... | |
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush.
Qt supports both simple and extended radial gradients.
Simple radial gradients interpolate colors between a focal point and end points on a circle surrounding it. Extended radial gradients interpolate colors between a focal circle and a center circle. Points outside the cone defined by the two circles will be transparent. For simple radial gradients the focal point is adjusted to lie inside the center circle, whereas the focal point can have any position in an extended radial gradient.
Outside the end points the gradient is either padded, reflected or repeated depending on the currently set QGradient::Spread{spread} method:
QGradient::PadSpread{PadSpread} (default) | QGradient::ReflectSpread{ReflectSpread} | QGradient::RepeatSpread{RepeatSpread} |
The colors in a gradient is defined using stop points of the QGradientStop type, i.e. a position and a color. Use the QGradient::setColorAt() or the QGradient::setStops() function to define the stop points. It is the gradient's complete set of stop points that describes how the gradient area should be filled. If no stop points have been specified, a gradient of black at 0 to white at 1 is used.
In addition to the functions inherited from QGradient, the QRadialGradient class provides the center(), focalPoint() and radius() functions returning the gradient's center, focal point and radius respectively.
QRadialGradient::QRadialGradient | ( | ) |
Constructs a simple radial gradient with the center and focal point at (0, 0) with a radius of 1.
Definition at line 2040 of file qbrush.cpp.
QRadialGradient::QRadialGradient | ( | const QPointF & | center, |
qreal | radius, | ||
const QPointF & | focalPoint | ||
) |
Constructs a simple radial gradient with the given center, radius and focalPoint.
Definition at line 1959 of file qbrush.cpp.
Constructs a simple radial gradient with the given center (cx, cy), radius and focal point (fx, fy).
Definition at line 2002 of file qbrush.cpp.
Constructs a simple radial gradient with the given center, radius and the focal point in the circle center.
Definition at line 1978 of file qbrush.cpp.
Constructs a simple radial gradient with the center at (cx, cy) and the specified radius.
The focal point lies at the center of the circle.
Definition at line 2024 of file qbrush.cpp.
QRadialGradient::QRadialGradient | ( | const QPointF & | center, |
qreal | centerRadius, | ||
const QPointF & | focalPoint, | ||
qreal | focalRadius | ||
) |
Constructs an extended radial gradient with the given center, centerRadius, focalPoint, and focalRadius.
Definition at line 2060 of file qbrush.cpp.
QRadialGradient::QRadialGradient | ( | qreal | cx, |
qreal | cy, | ||
qreal | centerRadius, | ||
qreal | fx, | ||
qreal | fy, | ||
qreal | focalRadius | ||
) |
Constructs an extended radial gradient with the given center (cx, cy), center radius, centerRadius, focal point, (fx, fy), and focal radius focalRadius.
Definition at line 2083 of file qbrush.cpp.
QPointF QRadialGradient::center | ( | ) | const |
Returns the center of this radial gradient in logical coordinates.
Definition at line 2102 of file qbrush.cpp.
Referenced by qt_isExtendedRadialGradient(), QSvgPaintEngine::saveRadialGradientBrush(), QVGPaintEnginePrivate::setBrush(), QCoreGraphicsPaintEnginePrivate::setFillBrush(), QSpanData::setup(), QGL2PaintEngineExPrivate::updateBrushUniforms(), and QOpenGLPaintEnginePrivate::updateGradient().
qreal QRadialGradient::centerRadius | ( | ) | const |
Returns the center radius of this radial gradient in logical coordinates.
Definition at line 2182 of file qbrush.cpp.
Referenced by QSpanData::setup(), and QGL2PaintEngineExPrivate::updateBrushUniforms().
QPointF QRadialGradient::focalPoint | ( | ) | const |
Returns the focal point of this radial gradient in logical coordinates.
Definition at line 2251 of file qbrush.cpp.
Referenced by qt_isExtendedRadialGradient(), QSvgPaintEngine::saveRadialGradientBrush(), QCoreGraphicsPaintEnginePrivate::setFillBrush(), QSpanData::setup(), QGL2PaintEngineExPrivate::updateBrushUniforms(), and QOpenGLPaintEnginePrivate::updateGradient().
qreal QRadialGradient::focalRadius | ( | ) | const |
Returns the focal radius of this radial gradient in logical coordinates.
Definition at line 2211 of file qbrush.cpp.
Referenced by qt_isExtendedRadialGradient(), QCoreGraphicsPaintEnginePrivate::setFillBrush(), QSpanData::setup(), and QGL2PaintEngineExPrivate::updateBrushUniforms().
qreal QRadialGradient::radius | ( | ) | const |
Returns the radius of this radial gradient in logical coordinates.
Equivalent to centerRadius()
Definition at line 2150 of file qbrush.cpp.
Referenced by qt_isExtendedRadialGradient(), QSvgPaintEngine::saveRadialGradientBrush(), QCoreGraphicsPaintEnginePrivate::setFillBrush(), and QOpenGLPaintEnginePrivate::updateGradient().
void QRadialGradient::setCenter | ( | const QPointF & | center | ) |
Sets the center of this radial gradient in logical coordinates to center.
Definition at line 2134 of file qbrush.cpp.
Sets the center of this radial gradient in logical coordinates to (x, y).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 312 of file qbrush.h.
Referenced by setCenter().
void QRadialGradient::setCenterRadius | ( | qreal | radius | ) |
Sets the center radius of this radial gradient in logical coordinates to radius
Definition at line 2194 of file qbrush.cpp.
void QRadialGradient::setFocalPoint | ( | const QPointF & | focalPoint | ) |
Sets the focal point of this radial gradient in logical coordinates to focalPoint.
Definition at line 2283 of file qbrush.cpp.
Sets the focal point of this radial gradient in logical coordinates to (x, y).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 316 of file qbrush.h.
Referenced by setFocalPoint().
void QRadialGradient::setFocalRadius | ( | qreal | radius | ) |
Sets the focal radius of this radial gradient in logical coordinates to radius
Definition at line 2228 of file qbrush.cpp.
void QRadialGradient::setRadius | ( | qreal | radius | ) |
Sets the radius of this radial gradient in logical coordinates to radius
Equivalent to setCenterRadius()
Definition at line 2165 of file qbrush.cpp.