本文整理汇总了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;
}
示例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());
}
示例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);
}
示例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;
}