Logo Search packages:      
Sourcecode: qt4-x11 version File versions

void QPainterPath::cubicTo ( const QPointF c1,
const QPointF c2,
const QPointF endPoint 
)

Adds a cubic Bezier curve between the current position and the given endPoint using the control points specified by c1, and c2.

After the curve is added, the current position is updated to be at the end point of the curve.

100% qpainterpath-cubicto.png doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 1

See also:
quadTo(), {QPainterPath::Composing a QPainterPath}{Composing a QPainterPath}

Definition at line 724 of file qpainterpath.cpp.

References QPointF::x(), and QPointF::y().

Referenced by addEllipse(), arcTo(), cubicTo(), QPicture::exec(), Mouse::paint(), quadTo(), and toReversed().

{
#ifdef QPP_DEBUG
    printf("QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n",
           c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y());
#endif
#ifndef QT_NO_DEBUG
    if (qt_is_nan(c1.x()) || qt_is_nan(c1.y()) || qt_is_nan(c2.x()) || qt_is_nan(c2.y())
        || qt_is_nan(e.x()) || qt_is_nan(e.y()))
        qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN, results are undefined");
#endif
    ensureData();
    detach();

    QPainterPathData *d = d_func();
    Q_ASSERT(!d->elements.isEmpty());


    // Abort on empty curve as a stroker cannot handle this and the
    // curve is irrelevant anyway.
    if (d->elements.last() == c1 && c1 == c2 && c2 == e)
        return;

    d->maybeMoveTo();

    Element ce1 = { c1.x(), c1.y(), CurveToElement };
    Element ce2 = { c2.x(), c2.y(), CurveToDataElement };
    Element ee = { e.x(), e.y(), CurveToDataElement };
    d->elements << ce1 << ce2 << ee;
}


Generated by  Doxygen 1.6.0   Back to index