⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qbrush.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 4 页
字号:
    \sa start()*/void QLinearGradient::setStart(const QPointF &start){    Q_ASSERT(m_type == LinearGradient);    m_data.linear.x1 = start.x();    m_data.linear.y1 = start.y();}/*!    \fn void QLinearGradient::setFinalStop(qreal x, qreal y)    \overload    \since 4.2    Sets the final stop point of this linear gradient in logical    coordinates to \a x, \a y.    \sa start()*//*!    Returns the final stop point of this linear gradient in logical coordinates.    \sa QGradient::stops()*/QPointF QLinearGradient::finalStop() const{    Q_ASSERT(m_type == LinearGradient);    return QPointF(m_data.linear.x2, m_data.linear.y2);}/*!    \since 4.2    Sets the final stop point of this linear gradient in logical    coordinates to \a stop.    \sa finalStop()*/void QLinearGradient::setFinalStop(const QPointF &stop){    Q_ASSERT(m_type == LinearGradient);    m_data.linear.x2 = stop.x();    m_data.linear.y2 = stop.y();}/*!    \class QRadialGradient    \ingroup multimedia    \brief The QRadialGradient class is used in combination with QBrush to    specify a radial gradient brush.    Radial gradients interpolate colors between a focal point and end    points on a circle surrounding it. Outside the end points the    gradient is either padded, reflected or repeated depending on the    currently set \l {QGradient::Spread}{spread} method:    \table    \row    \o \inlineimage qradialgradient-pad.png    \o \inlineimage qradialgradient-reflect.png    \o \inlineimage qradialgradient-repeat.png    \row    \o \l {QGradient::PadSpread}{PadSpread} (default)    \o \l {QGradient::ReflectSpread}{ReflectSpread}    \o \l {QGradient::RepeatSpread}{RepeatSpread}    \endtable    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.    \sa QLinearGradient, QConicalGradient, {demos/gradients}{The    Gradients Demo}*/static QPointF qt_radial_gradient_adapt_focal_point(const QPointF &center,                                                    qreal radius,                                                    const QPointF &focalPoint){    // We have a one pixel buffer zone to avoid numerical instability on the    // circle border    //### this is hacky because technically we should adjust based on current matrix    const qreal compensated_radius = radius - 0.0000000001;    QLineF line(center, focalPoint);    if (line.length() > (compensated_radius))        line.setLength(compensated_radius);    return line.p2();}/*!    Constructs a radial gradient with the given \a center, \a    radius and \a focalPoint.    \sa QGradient::setColorAt(), QGradient::setStops()*/QRadialGradient::QRadialGradient(const QPointF &center, qreal radius, const QPointF &focalPoint){    m_type = RadialGradient;    m_spread = PadSpread;    m_data.radial.cx = center.x();    m_data.radial.cy = center.y();    m_data.radial.radius = radius;    QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(center, radius, focalPoint);    m_data.radial.fx = adapted_focal.x();    m_data.radial.fy = adapted_focal.y();}/*!    Constructs a radial gradient with the given \a center, \a    radius and the focal point in the circle center.    \sa QGradient::setColorAt(), QGradient::setStops()*/QRadialGradient::QRadialGradient(const QPointF &center, qreal radius){    m_type = RadialGradient;    m_spread = PadSpread;    m_data.radial.cx = center.x();    m_data.radial.cy = center.y();    m_data.radial.radius = radius;    m_data.radial.fx = center.x();    m_data.radial.fy = center.y();}/*!    Constructs a radial gradient with the given center (\a cx, \a cy),    \a radius and focal point (\a fx, \a fy).    \sa QGradient::setColorAt(), QGradient::setStops()*/QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius, qreal fx, qreal fy){    m_type = RadialGradient;    m_spread = PadSpread;    m_data.radial.cx = cx;    m_data.radial.cy = cy;    m_data.radial.radius = radius;    QPointF adapted_focal = qt_radial_gradient_adapt_focal_point(QPointF(cx, cy),                                                                 radius,                                                                 QPointF(fx, fy));    m_data.radial.fx = adapted_focal.x();    m_data.radial.fy = adapted_focal.y();}/*!    Constructs a radial gradient with the center at (\a cx, \a cy) and the    specified \a radius. The focal point lies at the center of the circle.    \sa QGradient::setColorAt(), QGradient::setStops() */QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal radius){    m_type = RadialGradient;    m_spread = PadSpread;    m_data.radial.cx = cx;    m_data.radial.cy = cy;    m_data.radial.radius = radius;    m_data.radial.fx = cx;    m_data.radial.fy = cy;}/*!    Constructs a radial gradient with the center and focal point at    (0, 0) with a radius of 1.*/QRadialGradient::QRadialGradient(){    m_type = RadialGradient;    m_spread = PadSpread;    m_data.radial.cx = 0;    m_data.radial.cy = 0;    m_data.radial.radius = 1;    m_data.radial.fx = 0;    m_data.radial.fy = 0;}/*!    Returns the center of this radial gradient in logical coordinates.    \sa QGradient::stops()*/QPointF QRadialGradient::center() const{    Q_ASSERT(m_type == RadialGradient);    return QPointF(m_data.radial.cx, m_data.radial.cy);}/*!    \fn void QRadialGradient::setCenter(qreal x, qreal y)    \overload    \since 4.2    Sets the center of this radial gradient in logical coordinates    to (\a x, \a y).    \sa center()*//*!    \since 4.2    Sets the center of this radial gradient in logical coordinates    to \a center.    \sa center()*/void QRadialGradient::setCenter(const QPointF &center){    Q_ASSERT(m_type == RadialGradient);    m_data.radial.cx = center.x();    m_data.radial.cy = center.y();}/*!    Returns the radius of this radial gradient in logical coordinates.    \sa QGradient::stops()*/qreal QRadialGradient::radius() const{    Q_ASSERT(m_type == RadialGradient);    return m_data.radial.radius;}/*!    \since 4.2    Sets the radius of this radial gradient in logical coordinates    to \a radius*/void QRadialGradient::setRadius(qreal radius){    Q_ASSERT(m_type == RadialGradient);    m_data.radial.radius = radius;}/*!    Returns the focal point of this radial gradient in logical    coordinates.    \sa QGradient::stops()*/QPointF QRadialGradient::focalPoint() const{    Q_ASSERT(m_type == RadialGradient);    return QPointF(m_data.radial.fx, m_data.radial.fy);}/*!    \fn void QRadialGradient::setFocalPoint(qreal x, qreal y)    \overload    \since 4.2    Sets the focal point of this radial gradient in logical    coordinates to (\a x, \a y).    \sa focalPoint()*//*!    \since 4.2    Sets the focal point of this radial gradient in logical    coordinates to \a focalPoint.    \sa focalPoint()*/void QRadialGradient::setFocalPoint(const QPointF &focalPoint){    Q_ASSERT(m_type == RadialGradient);    m_data.radial.fx = focalPoint.x();    m_data.radial.fy = focalPoint.y();}/*!    \class QConicalGradient    \ingroup multimedia    \brief The QConicalGradient class is used in combination with QBrush to    specify a conical gradient brush.    Conical gradients interpolate interpolate colors counter-clockwise    around a center point.    \image qconicalgradient.png    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    QConicalGradient class provides the angle() and center() functions    returning the start angle and center of the gradient.    Note that the setSpread() function has no effect for conical    gradients. The reason is that the conical gradient is closed by    definition, i.e. the conical gradient fills the entire circle from    0 - 360 degrees, while the boundary of a radial or a linear    gradient can be specified through its radius or final stop points,    respectively.    \sa QLinearGradient, QRadialGradient, {demos/gradients}{The    Gradients Demo}*//*!    Constructs a conical gradient with the given \a center, starting    the interpolation at the given \a angle. The \a angle must be    specified in degrees between 0 and 360.    \sa QGradient::setColorAt(), QGradient::setStops()*/QConicalGradient::QConicalGradient(const QPointF &center, qreal angle){    m_type = ConicalGradient;    m_spread = PadSpread;    m_data.conical.cx = center.x();    m_data.conical.cy = center.y();    m_data.conical.angle = angle;}/*!    Constructs a conical gradient with the given center (\a cx, \a    cy), starting the interpolation at the given \a angle. The angle    must be specified in degrees between 0 and 360.    \sa QGradient::setColorAt(), QGradient::setStops()*/QConicalGradient::QConicalGradient(qreal cx, qreal cy, qreal angle){    m_type = ConicalGradient;    m_spread = PadSpread;    m_data.conical.cx = cx;    m_data.conical.cy = cy;    m_data.conical.angle = angle;}/*!    Constructs a conical with center at (0, 0) starting the    interpolation at angle 0.    \sa QGradient::setColorAt(), setCenter(), setAngle()*/QConicalGradient::QConicalGradient(){    m_type = ConicalGradient;    m_spread = PadSpread;    m_data.conical.cx = 0;    m_data.conical.cy = 0;    m_data.conical.angle = 0;}/*!    Returns the center of the conical gradient in logical    coordinates.    \sa stops()*/QPointF QConicalGradient::center() const{    Q_ASSERT(m_type == ConicalGradient);    return QPointF(m_data.conical.cx, m_data.conical.cy);}/*!    \fn void QConicalGradient::setCenter(qreal x, qreal y)    \overload    Sets the center of this conical gradient in logical coordinates to    (\a x, \a y).    \sa center()*//*!    Sets the center of this conical gradient in logical coordinates to    \a center.    \sa center()*/void QConicalGradient::setCenter(const QPointF &center){    Q_ASSERT(m_type == ConicalGradient);    m_data.conical.cx = center.x();    m_data.conical.cy = center.y();}/*!    Returns the start angle of the conical gradient in logical    coordinates.    \sa stops()*/qreal QConicalGradient::angle() const{    Q_ASSERT(m_type == ConicalGradient);    return m_data.conical.angle;}/*!    \since 4.2    Sets \a angle to be the start angle for this conical gradient in    logical coordinates.    \sa angle()*/void QConicalGradient::setAngle(qreal angle){    Q_ASSERT(m_type == ConicalGradient);    m_data.conical.angle = angle;}/*!    \typedef QGradientStop    \relates QGradient    Typedef for QPair<\l qreal, QColor>.*//*!    \typedef QGradientStops    \relates QGradient    Typedef for QVector<QGradientStop>.*//*!    \typedef QBrush::DataPtr    \internal*//*!    \fn DataPtr &QBrush::data_ptr()    \internal*//*!    \fn bool QBrush::isDetached() const    \internal*//*!    \fn QTransform QBrush::transform() const    \since 4.3    Returns the current transformation matrix for the brush.    \sa setTransform()*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -