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

void QPainterPath::addEllipse ( const QRectF boundingRectangle  ) 

Creates an ellipse within the the specified boundingRectangle and adds it to the painter path as a closed subpath.

The ellipse is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position).

100% qpainterpath-addellipse.png doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 5

See also:
arcTo(), QPainter::drawEllipse(), {QPainterPath::Composing a QPainterPath}{Composing a QPainterPath}

Definition at line 1028 of file qpainterpath.cpp.

References cubicTo(), QRectF::height(), QRectF::isNull(), moveTo(), QRectF::width(), QRectF::x(), and QRectF::y().

Referenced by addEllipse(), QRasterPaintEngine::drawEllipse(), QPainter::drawEllipse(), QPaintEngine::drawEllipse(), BasicToolsPlugin::generateShape(), Q3PointArray::makeEllipse(), Window::setupShapes(), Node::shape(), and SortingBox::SortingBox().

{
#ifndef QT_NO_DEBUG
    if (qt_is_nan(boundingRect.x()) || qt_is_nan(boundingRect.y())
        || qt_is_nan(boundingRect.width()) || qt_is_nan(boundingRect.height()))
        qWarning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN, results are undefined");
#endif
    if (boundingRect.isNull())
        return;

    ensureData();
    detach();

    Q_D(QPainterPath);
    d->elements.reserve(d->elements.size() + 13);

    QPointF pts[12];
    int point_count;
    QPointF start = qt_curves_for_arc(boundingRect, 0, -360, pts, &point_count);

    moveTo(start);
    cubicTo(pts[0], pts[1], pts[2]);           // 0 -> 270
    cubicTo(pts[3], pts[4], pts[5]);           // 270 -> 180
    cubicTo(pts[6], pts[7], pts[8]);           // 180 -> 90
    cubicTo(pts[9], pts[10], pts[11]);         // 90 - >0
    d_func()->require_moveTo = true;
}


Generated by  Doxygen 1.6.0   Back to index