当前位置: 首页>>代码示例>>C++>>正文


C++ QPainterPath::cubicTo方法代码示例

本文整理汇总了C++中QPainterPath::cubicTo方法的典型用法代码示例。如果您正苦于以下问题:C++ QPainterPath::cubicTo方法的具体用法?C++ QPainterPath::cubicTo怎么用?C++ QPainterPath::cubicTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QPainterPath的用法示例。


在下文中一共展示了QPainterPath::cubicTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createSmoothCurve

QPainterPath SmoothCurveCreator::createSmoothCurve(const QList<QPointF> &points) {
    QPainterPath path;
    int len = points.size();

    if (len < 2) {
        return path;
    }

    QList<QPointF> firstControlPoints;
    QList<QPointF> secondControlPoints;
    calculateControlPoints(points, &firstControlPoints, &secondControlPoints);

    path.moveTo(points[0].x(), points[0].y());

    // Using bezier curve to gelnerate a smooth curve.
    for (int i = 0; i < len - 1; ++i) {
        path.cubicTo(firstControlPoints[i], secondControlPoints[i], points[i+1]);
    }

    return path;
}
开发者ID:wc3100502037,项目名称:QT_turbo,代码行数:21,代码来源:smoothcurvecreator.cpp

示例2: updatePath

void QNEConnection::updatePath()
{
    QPainterPath p;

    //QPointF pos1(m_port1->scenePos());
    //QPointF pos2(m_port2->scenePos());

    p.moveTo(m_pos1);

    QPointF ctrl1, ctrl2;

    ctrl1.setX(m_pos1.x() + (m_port1 ? m_port1->dir().x() : -m_port2->dir().x()) * 50.f);
    ctrl1.setY(m_pos1.y());

    ctrl2.setX(m_pos2.x() + (m_port2 ? m_port2->dir().x() : -m_port1->dir().x()) * 50.f);
    ctrl2.setY(m_pos2.y());

    p.cubicTo(ctrl1, ctrl2, m_pos2);

    setPath(p);
}
开发者ID:ggggamer,项目名称:silkopter,代码行数:21,代码来源:qneconnection.cpp

示例3: redrawArc

void YigModField::redrawArc()
{
    qreal arcAngle;
    float arcWidth, arcHeight;

    arcAngle = rotationAngle;

    QPainterPath arcPath;

    arcPath.moveTo(boundingRect().center());
    /*
    //arcPath.moveTo((YigSynthGraphic::MOD_FIELD_SIZE/2) - (YigSynthGraphic::MOD_FIELD_2_SIZE/2), YigSynthGraphic::MOD_FIELD_SIZE/2);
    arcPath.cubicTo(boundingRect().center(), QPointF(0, 0), QPointF(0, boundingRect().height()/2));
    //QPointF endPoint(0, boundingRect().height()/2);
    */

    float size = rotationAngle/360;

    QRectF angleRect = QRectF((boundingRect().width()/2) - ((boundingRect().width()/2) * size),
                              (boundingRect().height()/2) - ((boundingRect().height()/2) * size),
                              boundingRect().width() * size,
                              boundingRect().height() * size);

    /*
    //arcPath.addEllipse(angleRect.center(), angleRect.width() * size /2, angleRect.height() * size /2);
    arcPath.cubicTo(angleRect.topLeft() * size,
                    angleRect.bottomRight() * size,
                    angleRect.bottomRight());
    arcPath.cubicTo(angleRect.topLeft() * size,
                    angleRect.bottomRight() * size,
                    angleRect.center());
    arcPath.setFillRule(Qt::OddEvenFill);*/

    arcPath.arcTo(boundingRect(), -180, rotationAngle);
    arcPath.cubicTo(boundingRect().bottomLeft(), boundingRect().topRight(), boundingRect().center());

    QPolygonF arcPolygon = arcPath.toFillPolygon();
    modArc.setPolygon(arcPolygon);
}
开发者ID:ChadMcKinney,项目名称:Yig,代码行数:39,代码来源:yigsynthgraphic.cpp

示例4: makePath

QPainterPath GraphScene::makePath(TimeLine * l, int minidx, int maxidx, bool zero_edges) {
		QPainterPath path;
	 	QPointF p1;
	 	QPointF p2;
		for (int j=minidx;j<=maxidx;j++) {			 		
			 		p2.setX(((TimeIndex*)l->at(j))->getTime());
		 			p2.setY(l->at(j)->getData()->getValue());
			 		if (zero_edges==true && j==minidx) {
			 			path.moveTo(QPointF(p2.x(),0));
			 		}
		    	if (draw_smooth==false) {
		    		if (j==minidx && zero_edges ==false) {
		    			path.moveTo(p2);
		    		} else {
		    			path.lineTo(p2);
		    		}			    		
		    	} else {
		    		if (j==minidx) {
		    			if (zero_edges) {
		    				path.lineTo(p2);
		    			} else {
		    				path.moveTo(p2);
		    			}
		  			} else {
		    			double distance = p2.x() - p1.x();
		    			path.cubicTo(p1.x() + distance / 2, p1.y(),
							p1.x() + distance / 2, p2.y(),
							p2.x(), p2.y());    		
		    		}
		    	}
			 		if (zero_edges==true && j==maxidx) {
			 			path.lineTo(QPointF(p2.x(),0));
			 		}
		    	
			 		p1=p2;
				}
		
		return path;
}
开发者ID:AnthonyCAS,项目名称:ssl-vision,代码行数:39,代码来源:GraphScene.cpp

示例5: isEditable

void DrawableSpline2D::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
    if (!isDisplayed()) return;

    if (_object->nbMarkers() >= 2) // we must have at least 2 points
    {
        if(_currentShapePath) delete _currentShapePath;
        _currentShapePath = new QPainterPath;

        QPen pen = (isSelected() && isEditable() ? _penList[DrawableObject2D::Selected] : _penList[DrawableObject2D::Unselected]);
        painter->setPen(pen);
        painter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform);
        double *tcp = static_cast<Spline2D*>(_object.get())->getControlPoints();
        QPainterPath path;
        for (unsigned int i=0; i<_object->nbMarkers()-1; i++, tcp+=9)
        {
            /*
             * Cubic Bezier curve:
             *  tcp[0] = x0, tcp[1] = y0 -> starting point
             *  tcp[3] = x1, tcp[4] = y1 -> control point 1
             *  tcp[6] = x2, tcp[7] = y2 -> control point 2
             *  tcp[9] = x3, tcp[10] = y3 -> ending point
             * */
            double x0, y0, x1, y1, x2, y2, x3, y3;
            transformCoord(tcp[0], tcp[1], x0, y0);
            transformCoord(tcp[3], tcp[4], x1, y1);
            transformCoord(tcp[6], tcp[7], x2, y2);
            transformCoord(tcp[9], tcp[10], x3, y3);

            path.moveTo(x0, y0);
            path.cubicTo(x1, y1, x2, y2, x3, y3);
        }
        painter->drawPath(path);
        updateShapePath(path);
    }
    DrawableObject2D::paint(painter, option, widget);
}
开发者ID:ConfusedReality,项目名称:pkg_augmented-reality_polAR,代码行数:37,代码来源:DrawableSpline2D.cpp

示例6: paint

void PainterBezier::paint(QPainter * painter)
{
    painter->setBrush(Qt::transparent);
    QRectF rect = calculateBoundingBox();
    setX(rect.topLeft().x() - 10);
    setY( rect.topLeft().y() - 10);
    setWidth( rect.width() + 20);
    setHeight( rect.height() + 20);
    QPen pen;
    pen.setWidthF(m_OutlineWidth);
    pen.setBrush(m_OutlineColor);
    painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    painter->setPen(pen);
    painter->setBrush(m_FillColor);
    QPainterPath bezierPath;
    QPointF pos(x(),y());
    bezierPath.moveTo(m_p1 - pos);
    bezierPath.cubicTo( m_p2 - pos, m_p3 - pos, m_p4 - pos );
    QPainterPathStroker outliner;
    outliner.setWidth(m_FillWidth);
    outliner.setCapStyle( Qt::FlatCap );
    m_Path = outliner.createStroke(bezierPath);
    painter->drawPath(m_Path);
}
开发者ID:cadet,项目名称:UberQuick,代码行数:24,代码来源:PainterBezier.cpp

示例7: if

extern "C" void pathext_stroke_path(fz_device *dev, fz_path *path,
                                    fz_stroke_state *, const fz_matrix *ctm,
                                    fz_colorspace *, float *, float)
{
  PathExt *ext = static_cast<PathExt*>(dev->user);
  if( ext == 0 ) {
    return;
  }

  QPainterPath qPath;
  float *c = path->coords;
  for(int i = 0; i < path->cmd_len; i++) {
    if(        path->cmds[i] == FZ_MOVETO ) {
      qPath.moveTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_LINETO ) {
      qPath.lineTo(c[0], c[1]);
      c += 2;
    } else if( path->cmds[i] == FZ_CURVETO ) {
      qPath.cubicTo(c[0], c[1], c[2], c[3], c[4], c[5]);
      c += 6;
    } else if( path->cmds[i] == FZ_CLOSE_PATH ) {
      if( !ext->closed ) {
        return;
      }
      qPath.closeSubpath();
    } else {
      return;
    }
  }

  const QTransform qCtm = toTransform(ctm);
  qPath = qCtm.map(qPath);

  ext->paths.push_back(qPath);
}
开发者ID:CaSchmidt,项目名称:cslabs,代码行数:36,代码来源:fz_pathext.cpp

示例8: paintEvent

void Widget::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);

    QPainterPath path;
    //移动当前点到点(50, 250)
    path.moveTo(50, 250);
    //从当前点即(50, 250)绘制一条直线到点(50, 230),完成后当前点更改为(50, 230)
    path.lineTo(50, 230);
    //从当前点和点(120, 60)之间绘制一条三次贝塞尔曲线
    path.cubicTo(QPointF(105, 40), QPointF(115, 80), QPointF(120, 60));
    path.lineTo(130, 130);
    //向路径中添加一个椭圆
    path.addEllipse(QPoint(130, 130), 30, 30);

    painter.setPen(Qt::darkYellow);
    //绘制路径
    painter.drawPath(path);

    //平移坐标系统后重新绘制路径
    path.translate(200,0);
    painter.setPen(Qt::darkBlue);
    painter.drawPath(path);
}
开发者ID:github-jxm,项目名称:QtCrearor_fast_learn,代码行数:24,代码来源:widget.cpp

示例9: obtainCurvePath

QPainterPath LinkConnectionGraphicsItem::obtainCurvePath() const {
    QPointF inRight = inLink_->getRightPos();
    QPointF inLeft = inLink_->getLeftPos();
    QPointF outRight = outLink_->getRightPos();
    QPointF outLeft = outLink_->getLeftPos();

    QPointF start;
    QPointF stop;
    QPointF ctrlPointStart;
    QPointF ctrlPointStop;
    QPointF qp = QPointF(1, 0);
    QPainterPath bezierCurve;

    if (outLeft.x() <= inRight.x()) {
        start = outLeft;
        stop = inRight;
        ctrlPointStart = qp;
        ctrlPointStop = -qp;
    } else if (outRight.x() >= inLeft.x()) {
        start = outRight;
        stop = inLeft;
        ctrlPointStart = -qp;
        ctrlPointStop = qp;
    } else {
        start = outLeft;
        stop = inLeft;
        ctrlPointStart = qp;
        ctrlPointStop = qp;
    }

    float dist =
        1.0f + std::min(50.0f, 2.0f * static_cast<float>(QVector2D(start - stop).length()));
    bezierCurve.moveTo(start);
    bezierCurve.cubicTo(start + dist * ctrlPointStart, stop + dist * ctrlPointStop, stop);
    return bezierCurve;
}
开发者ID:ResearchDaniel,项目名称:inviwo,代码行数:36,代码来源:linkgraphicsitem.cpp

示例10: paint

void PathStrokeRenderer::paint(QPainter *painter)
{
    if (m_points.isEmpty())
        initializePoints();

    painter->setRenderHint(QPainter::Antialiasing);

    QPalette pal = palette();
    painter->setPen(Qt::NoPen);

    // Construct the path
    QPainterPath path;
    path.moveTo(m_points.at(0));

    if (m_pathMode == LineMode) {
        for (int i=1; i<m_points.size(); ++i)
            path.lineTo(m_points.at(i));
    } else {
        int i=1;
        while (i + 2 < m_points.size()) {
            path.cubicTo(m_points.at(i), m_points.at(i+1), m_points.at(i+2));
            i += 3;
        }
        while (i < m_points.size()) {
            path.lineTo(m_points.at(i));
            ++i;
        }
    }

    // Draw the path
    {
        QColor lg = Qt::red;

        // The "custom" pen
        if (m_penStyle == Qt::NoPen) {
            QPainterPathStroker stroker;
            stroker.setWidth(m_penWidth);
            stroker.setJoinStyle(m_joinStyle);
            stroker.setCapStyle(m_capStyle);

            QVector<qreal> dashes;
            qreal space = 4;
            dashes << 1 << space
                   << 3 << space
                   << 9 << space
                   << 27 << space
                   << 9 << space
                   << 3 << space;
            stroker.setDashPattern(dashes);
            QPainterPath stroke = stroker.createStroke(path);
            painter->fillPath(stroke, lg);

        } else {
            QPen pen(lg, m_penWidth, m_penStyle, m_capStyle, m_joinStyle);
            painter->strokePath(path, pen);
        }
    }

    if (1) {
        // Draw the control points
        painter->setPen(QColor(50, 100, 120, 200));
        painter->setBrush(QColor(200, 200, 210, 120));
        for (int i=0; i<m_points.size(); ++i) {
            QPointF pos = m_points.at(i);
            painter->drawEllipse(QRectF(pos.x() - m_pointSize,
                                       pos.y() - m_pointSize,
                                       m_pointSize*2, m_pointSize*2));
        }
        painter->setPen(QPen(Qt::lightGray, 0, Qt::SolidLine));
        painter->setBrush(Qt::NoBrush);
        painter->drawPolyline(m_points);
    }

}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:74,代码来源:pathstroke.cpp

示例11: buildShape

QImage ShapeState::buildShape(const std::vector<Point>& _points)
{
    if (_points.empty())
    {
        return QImage();
    }

    size_t n = _points.size();
    std::vector<Point> points = _points;

    QColor shapeColor(84, 84, 84);

    QPointF min, max;
    min.setX(std::numeric_limits<float>::max());
    min.setY(std::numeric_limits<float>::max());
    max.setX(std::numeric_limits<float>::lowest());
    max.setY(std::numeric_limits<float>::lowest());
    for (const auto& p: points)
    {
        max.setX(std::max(max.x(), p.point.x()));
        max.setY(std::max(max.y(), p.point.y()));
        min.setX(std::min(min.x(), p.point.x()));
        min.setY(std::min(min.y(), p.point.y()));
    }

    {
        //re-center the points
        QPointF center = (max + min) / 2.f;
        for (auto& p: points)
        {
            p.point -= center;
        }
    }

    QSizeF imageSize((max - min).x(), (max - min).y());
    imageSize += QSize(200, 200);
    QPointF imageCenter(imageSize.width() / 2.f, imageSize.height() / 2.f);

    QImage image = QImage(imageSize.toSize(), QImage::Format_RGBA8888_Premultiplied);
    image.fill(0);

    QPainter painter(&image);
    painter.setRenderHint(QPainter::Antialiasing, true);

    QPen pen(shapeColor, 3.f);
    pen.setCapStyle(Qt::RoundCap);
    pen.setJoinStyle(Qt::RoundJoin);
    painter.setPen(pen);

    QPainterPath path;

    //   Append and prepend knots and control points to close the curve

    {
        auto last = points.back();
        points.push_back(*(points.begin() + 0));
        points.push_back(*(points.begin() + 1));
        points.insert(points.begin(), last);
    }

    std::vector<QPointF> cp;
    for(size_t i = 0; i < n; i++)
    {
        QPointF cp0, cp1;
        getControlPoints(points[i].point, points[i + 1].point, points[i + 2].point, points[i].t, cp0, cp1);
        cp.push_back(cp0);
        cp.push_back(cp1);
    }
    cp.push_back(cp.front());
    for(size_t i = 1; i < n + 1; i++)
    {
        //var color=HSVtoRGB(Math.floor(240*(i-2)/(n-2)),0.8,0.8);
        //if(!showDetails){color="#555555"}
        //ctx.strokeStyle=hexToCanvasColor(color,0.75);
        path.moveTo(imageCenter + points[i].point);
        path.cubicTo(imageCenter + cp[i*2 - 1], imageCenter + cp[i*2], imageCenter + points[i + 1].point);
    }

    path.setFillRule(Qt::WindingFill);
    painter.drawPath(path);

    return floodFill(image, imageCenter.toPoint(), shapeColor.rgb());
}
开发者ID:porkmarks,项目名称:mthesis,代码行数:83,代码来源:ShapeState.cpp

示例12: path_draw


//.........这里部分代码省略.........
						++j;
					}

					end_point.setX(s1.toFloat() * current_size_x / first_size_x + mStartX);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}
					end_point.setY(s1.toFloat() * current_size_y / first_size_y + mStartY);
					++j;
					s1.clear();
				}

				 path.lineTo(end_point);
				 i = j;
			}
			 else if (d_cont[i] == 'C')
			{
				j = i + 2;
				while(isNotLCMZ(d_cont, j))
				{
					while (!(d_cont[j] == ' '))
					{
						s1.append(d_cont[j]);
						++j;
					}

					c1.setX(s1.toFloat() * current_size_x / first_size_x + mStartX);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}

					c1.setY(s1.toFloat() * current_size_y / first_size_y + mStartY);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}

					c2.setX(s1.toFloat() * current_size_x / first_size_x + mStartX);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}

					c2.setY(s1.toFloat() * current_size_y / first_size_y + mStartY);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}

					end_point.setX(s1.toFloat() * current_size_x / first_size_x + mStartX);
					s1.clear();
					++j;

					while (d_cont[j] != ' ')
					{
						s1.append(d_cont[j]);
						++j;
					}

					end_point.setY(s1.toFloat() * current_size_y / first_size_y + mStartY);
					s1.clear();
					++j;
				}

				path.cubicTo(c1, c2, end_point);
				i = j;

			} else if (d_cont[i] == 'Z')
			{
				path.closeSubpath();
				logger ("loggerZ.txt", "DONE");
			}
		}
	}

	parsestyle(element);
	painter->drawPath(path);
}
开发者ID:DenisTi,项目名称:qreal,代码行数:101,代码来源:sdfRenderer.cpp

示例13: parsePathDataFast


//.........这里部分代码省略.........
                break;
            case 'H': {
                x = num[0];
                num++;
                count--;
                path.lineTo(x, y);
            }
                break;
            case 'v': {
                y = num[0] + offsetY;
                num++;
                count--;
                path.lineTo(x, y);
            }
                break;
            case 'V': {
                y = num[0];
                num++;
                count--;
                path.lineTo(x, y);
            }
                break;
            case 'c': {
                if (count < 6) {
                    num += count;
                    count = 0;
                    break;
                }
                QPointF c1(num[0] + offsetX, num[1] + offsetY);
                QPointF c2(num[2] + offsetX, num[3] + offsetY);
                QPointF e(num[4] + offsetX, num[5] + offsetY);
                num += 6;
                count -= 6;
                path.cubicTo(c1, c2, e);
                ctrlPt = c2;
                x = e.x();
                y = e.y();
                break;
            }
            case 'C': {
                if (count < 6) {
                    num += count;
                    count = 0;
                    break;
                }
                QPointF c1(num[0], num[1]);
                QPointF c2(num[2], num[3]);
                QPointF e(num[4], num[5]);
                num += 6;
                count -= 6;
                path.cubicTo(c1, c2, e);
                ctrlPt = c2;
                x = e.x();
                y = e.y();
                break;
            }
            case 's': {
                if (count < 4) {
                    num += count;
                    count = 0;
                    break;
                }
                QPointF c1;
                if (lastMode == 'c' || lastMode == 'C' ||
                    lastMode == 's' || lastMode == 'S')
                    c1 = QPointF(2*x-ctrlPt.x(), 2*y-ctrlPt.y());
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:67,代码来源:qquicksvgparser.cpp

示例14: updatePath

//!
//! Updates the path end points according to the positions of start and end
//! nodes.
//!
void ConnectionGraphicsItem::updatePath ()
{
    prepareGeometryChange();

    // calculate positions of the end points
    QPointF startPoint = m_startPoint;
    QPointF endPoint = m_endPoint;
    if (m_startNodeItem)
        startPoint += m_startNodeItem->pos();
    if (m_endNodeItem)
        endPoint += m_endNodeItem->pos();

    // calculate the rectangles to help calculating the positions of the node's anchor points
    const qreal offset = 10;
    QRectF baseAnchorRect = QRectF(-offset, -offset, 2 * offset, 2 * offset);
    QRectF startAnchorRect = baseAnchorRect.translated(startPoint);
    QRectF endAnchorRect = baseAnchorRect.translated(endPoint);
    if (m_startNodeItem)
        startAnchorRect = m_startNodeItem->rect().adjusted(-offset, -offset, offset, offset).translated(m_startNodeItem->pos());
    if (m_endNodeItem)
        endAnchorRect = m_endNodeItem->rect().adjusted(-offset, -offset, offset, offset).translated(m_endNodeItem->pos());

    //
    // Diagram of anchor points for start and end nodes:
    //
    //    x        x      sU2, sU1     eU1, eU2      x        x
    //      ,----,                                     ,----,
    //      |    |                                     |    |
    //      |    |                                     |    |
    //      |   x| x      sP, sO         eO, eP      x |x   |
    //      '----'                                     '----'
    //    x        x      sL2, sL1     eL1, eL2      x        x
    //

    QPointF sP = startPoint;
    QPointF sO = QPointF(startAnchorRect.right(), startPoint.y());
    QPointF sU1 = startAnchorRect.topRight();
    QPointF sU2 = startAnchorRect.topLeft();
    QPointF sL1 = startAnchorRect.bottomRight();
    QPointF sL2 = startAnchorRect.bottomLeft();

    QPointF eP = endPoint;
    QPointF eO = QPointF(endAnchorRect.left(), endPoint.y());
    QPointF eU1 = endAnchorRect.topLeft();
    QPointF eU2 = endAnchorRect.topRight();
    QPointF eL1 = endAnchorRect.bottomLeft();
    QPointF eL2 = endAnchorRect.bottomRight();

    // declare path segments
    QList<QPointF> startPoints;
    QPainterPath cubicPath;
    QList<QPointF> endPoints;

    // construct the path segments
    if (eO.x() < sO.x() && eU2.x() > sL2.x() && eU2.y() < sL2.y() && eL2.y() > sU2.y()) {
        //> case 1V: elements very close to each other
        startPoints << sP << sO;

        QPointF offsetVector = QPointF(0, 0.75 * (eO.y() - sO.y()));
        cubicPath.moveTo(sO);
        cubicPath.cubicTo(sO + offsetVector, eO - offsetVector, eO);

        endPoints << eO << eP;
    } else if (eO.x() >= sO.x()) {
        //> case 1H: end node is right of start node
        startPoints << sP << sO;

        QPointF offsetVector = QPointF(0.75 * (eO.x() - sO.x()), 0);
        cubicPath.moveTo(sO);
        cubicPath.cubicTo(sO + offsetVector, eO - offsetVector, eO);

        endPoints << eO << eP;
    } else if (eU1.y() >= sL1.y()) {
        //> case 2LV
        startPoints << sP << sO << sL1;

        QPointF offsetVector = QPointF(0, 0.75 * (eU1.y() - sL1.y()));
        cubicPath.moveTo(sL1);
        cubicPath.cubicTo(sL1 + offsetVector, eU1 - offsetVector, eU1);

        endPoints << eU1 << eO << eP;
    } else if (eL1.y() <= sU1.y()) {
        //> case 2UV
        startPoints << sP << sO << sU1;

        QPointF offsetVector = QPointF(0, 0.75 * (eL1.y() - sU1.y()));
        cubicPath.moveTo(sU1);
        cubicPath.cubicTo(sU1 + offsetVector, eL1 - offsetVector, eL1);

        endPoints << eL1 << eO << eP;
    } else if (eP.y() >= sP.y()) {
        //> case 3L
        startPoints << sP << sO << sL1 << sL2;

        QPointF offsetVector = QPointF(0.75 * (eU2.x() - sL2.x()), 0);
        cubicPath.moveTo(sL2);
//.........这里部分代码省略.........
开发者ID:banduladh,项目名称:levelfour,代码行数:101,代码来源:ConnectionGraphicsItem.cpp

示例15: fire

QPainterPath Paths::fire()
{
    QPainterPath path;

    path.moveTo(362.83759,116.70426);
    path.cubicTo(342.56574,131.59686, 300.71403,161.23127, 311.38454,218.12635);
    path.cubicTo(322.05506,275.02144, 358.53432,301.66527, 328.90674,328.73285);
    path.cubicTo(299.27916,355.80044, 251.48877,339.59410, 255.46042,288.61972);
    path.cubicTo(258.22374,253.15368, 278.34141,205.10942, 278.34141,205.10942);
    path.cubicTo(278.34141,205.10942, 234.02455,233.13427, 219.68939,254.01270);
    path.cubicTo(205.35424,274.89113, 189.71452,330.07842, 208.58356,373.33974);
    path.cubicTo(227.45261,416.60109, 316.46286,456.33444, 351.12048,514.32780);
    path.cubicTo(374.10258,552.78425, 355.05815,613.59741, 310.80422,636.59310);
    path.cubicTo(256.63287,664.74219, 299.16588,580.49238, 285.22551,523.86186);
    path.cubicTo(273.46790,476.09839, 265.70022,445.12001, 188.03132,432.51681);
    path.cubicTo(233.72591,465.34901, 242.16068,495.04075, 241.45928,524.11772);
    path.cubicTo(240.78648,552.00862, 214.39595,634.57293, 177.39967,596.79021);
    path.cubicTo(140.72642,559.33737, 214.27071,512.68654, 170.92945,471.62081);
    path.cubicTo(174.73284,501.40284, 145.30515,514.98828, 131.55318,544.54392);
    path.cubicTo(118.22673,573.18509, 123.55251,610.30651, 139.07596,645.41379);
    path.cubicTo(181.14122,740.38745, 266.95518,726.23964, 208.75321,797.88229);
    path.cubicTo(164.01134,852.95649, 162.90150,907.45084, 205.60384,970.81121);
    path.cubicTo(240.06795,1021.9479, 371.11663,1060.7652, 432.20697,960.93460);
    path.cubicTo(501.87852,820.00694, 357.14883,780.33174, 386.29974,732.84721);
    path.cubicTo(405.70205,701.24238, 472.56601,668.86516, 501.09199,644.21233);
    path.cubicTo(564.18184,587.55421, 561.84437,497.32621, 522.74229,471.25817);
    path.cubicTo(530.19030,501.05022, 514.99952,542.79339, 483.67099,551.29691);
    path.cubicTo(423.41173,567.65308, 458.18351,411.79373, 564.02075,393.61925);
    path.cubicTo(530.91135,366.44998, 501.31413,367.33484, 454.91711,379.11707);
    path.cubicTo(397.61736,393.57908, 407.64322,315.40944, 494.34643,262.67861);
    path.cubicTo(549.19500,229.32101, 499.11573,147.63302, 491.66772,136.46100);
    path.cubicTo(485.38713,213.93294, 435.43515,233.35601, 409.98053,235.72292);
    path.cubicTo(375.27049,238.95043, 377.84554,214.33812, 396.75003,178.92950);
    path.cubicTo(416.21172,142.47722, 448.15395,89.429942, 376.51366,44.060977);
    path.cubicTo(388.13560,71.270572, 395.93673,94.012962, 362.83759,116.70426);
    path.closeSubpath();
    return path;
}
开发者ID:RS102839,项目名称:qt,代码行数:38,代码来源:paths.cpp


注:本文中的QPainterPath::cubicTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。