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


C++ KoPathShape::curveTo方法代码示例

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


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

示例1: KoPathShape

KoShape *KoPathShapeFactory::createDefaultShape(KoDocumentResourceManager *) const
{
    KoPathShape* path = new KoPathShape();
    path->moveTo(QPointF(0, 50));
    path->curveTo(QPointF(0, 120), QPointF(50, 120), QPointF(50, 50));
    path->curveTo(QPointF(50, -20), QPointF(100, -20), QPointF(100, 50));
    path->normalize();
    path->setStroke(new KoShapeStroke(1.0));
    return path;
}
开发者ID:KDE,项目名称:calligra,代码行数:10,代码来源:KoPathShapeFactory.cpp

示例2: changeToLine

void TestSegmentTypeCommand::changeToLine()
{
    KoPathShape path;
    path.moveTo( QPointF(0,0) );
    path.curveTo( QPointF(25,25), QPointF(75,25), QPointF(100,0) );

    KoPathPointData segment(&path, KoPathPointIndex(0,0));
    QList<KoPathPointData> segments;
    segments.append(segment);

    // get first segment
    KoPathSegment s = path.segmentByIndex(KoPathPointIndex(0,0));

    KoPathSegmentTypeCommand cmd(segments, KoPathSegmentTypeCommand::Line);

    QVERIFY(s.first()->activeControlPoint2());
    QVERIFY(s.second()->activeControlPoint1());

    cmd.redo();

    QVERIFY(!s.first()->activeControlPoint2());
    QVERIFY(!s.second()->activeControlPoint1());

    cmd.undo();

    QVERIFY(s.first()->activeControlPoint2());
    QVERIFY(s.second()->activeControlPoint1());
}
开发者ID:KDE,项目名称:calligra-history,代码行数:28,代码来源:TestSegmentTypeCommand.cpp

示例3: svgCurveToCubic

void KoPathShapeLoaderPrivate::svgCurveToCubic(qreal x1, qreal y1, qreal x2, qreal y2, qreal x, qreal y, bool abs)
{
    QPointF p1, p2;
    if (abs) {
        p1 = QPointF(x1, y1);
        p2 = QPointF(x2, y2);
        lastPoint = QPointF(x, y);
    } else {
        p1 = lastPoint + QPointF(x1, y1);
        p2 = lastPoint + QPointF(x2, y2);
        lastPoint += QPointF(x, y);
    }

    path->curveTo(p1, p2, lastPoint);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:15,代码来源:KoPathShapeLoader.cpp

示例4: bezierFit

KoPathShape * bezierFit(const QList<QPointF> &points, float error)
{
    FitVector tHat1, tHat2;

    tHat1 = ComputeLeftTangent(points, 0);
    tHat2 = ComputeRightTangent(points, points.count() - 1);

    int width = 0;
    QPointF *curve;
    curve = FitCubic(points, 0, points.count() - 1, tHat1, tHat2, error, width);

    KoPathShape * path = new KoPathShape();

    if (width > 3) {
        path->moveTo(curve[0]);
        path->curveTo(curve[1], curve[2], curve[3]);
        for (int i = 4; i < width; i += 4) {
            path->curveTo(curve[i+1], curve[i+2], curve[i+3]);
        }
    }

    delete[] curve;
    return path;
}
开发者ID:ChrisJong,项目名称:krita,代码行数:24,代码来源:KoCurveFit.cpp


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