Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstroker.cpp File Reference

(05fc3aef53348fb58be6308076e000825b704e58)

#include "private/qstroker_p.h"
#include "private/qbezier_p.h"
#include "qline.h"
#include "qtransform.h"
#include <qmath.h>
+ Include dependency graph for qstroker.cpp:

Go to the source code of this file.

Classes

class  QSubpathForwardIterator
 
class  QSubpathBackwardIterator
 
class  QSubpathFlatIterator
 

Functions

template<class Iterator >
bool qt_stroke_side (Iterator *it, QStroker *stroker, bool capFirst, QLineF *startTangent)
 
static qreal adapted_angle_on_x (const QLineF &line)
 
qreal qt_t_for_arc_angle (qreal angle)
 
Q_GUI_EXPORT void qt_find_ellipse_coords (const QRectF &r, qreal angle, qreal length, QPointF *startPoint, QPointF *endPoint)
 
QPointF qt_curves_for_arc (const QRectF &rect, qreal startAngle, qreal sweepLength, QPointF *curves, int *point_count)
 
static void qdashstroker_moveTo (qfixed x, qfixed y, void *data)
 
static void qdashstroker_lineTo (qfixed x, qfixed y, void *data)
 
static void qdashstroker_cubicTo (qfixed, qfixed, qfixed, qfixed, qfixed, qfixed, void *)
 
static bool lineRectIntersectsRect (qfixed2d p1, qfixed2d p2, const qfixed2d &tl, const qfixed2d &br)
 
static bool lineIntersectsRect (qfixed2d p1, qfixed2d p2, const qfixed2d &tl, const qfixed2d &br)
 

Function Documentation

◆ adapted_angle_on_x()

static qreal adapted_angle_on_x ( const QLineF & line)
inlinestatic

Definition at line 143 of file qstroker.cpp.

References QLineF::angleTo(), and line.

Referenced by QStroker::joinPoints().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lineIntersectsRect()

static bool lineIntersectsRect ( qfixed2d p1,
qfixed2d p2,
const qfixed2d & tl,
const qfixed2d & br )
static

Definition at line 1030 of file qstroker.cpp.

References lineRectIntersectsRect(), p1, p2, qSwap(), qfixed2d::x, and qfixed2d::y.

Referenced by QDashStroker::processCurrentSubpath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lineRectIntersectsRect()

static bool lineRectIntersectsRect ( qfixed2d p1,
qfixed2d p2,
const qfixed2d & tl,
const qfixed2d & br )
inlinestatic

Definition at line 1023 of file qstroker.cpp.

References p1, p2, qfixed2d::x, and qfixed2d::y.

Referenced by lineIntersectsRect(), and QDashStroker::processCurrentSubpath().

+ Here is the caller graph for this function:

◆ qdashstroker_cubicTo()

static void qdashstroker_cubicTo ( qfixed ,
qfixed ,
qfixed ,
qfixed ,
qfixed ,
qfixed ,
void *  )
inlinestatic

Definition at line 972 of file qstroker.cpp.

References Q_ASSERT.

Referenced by QDashStroker::QDashStroker().

+ Here is the caller graph for this function:

◆ qdashstroker_lineTo()

static void qdashstroker_lineTo ( qfixed x,
qfixed y,
void * data )
inlinestatic

Definition at line 968 of file qstroker.cpp.

Referenced by QDashStroker::QDashStroker().

+ Here is the caller graph for this function:

◆ qdashstroker_moveTo()

static void qdashstroker_moveTo ( qfixed x,
qfixed y,
void * data )
inlinestatic

Definition at line 964 of file qstroker.cpp.

Referenced by QDashStroker::QDashStroker().

+ Here is the caller graph for this function:

◆ qt_curves_for_arc()

QPointF qt_curves_for_arc ( const QRectF & rect,
qreal startAngle,
qreal sweepLength,
QPointF * curves,
int * point_count )

Creates a number of curves for a given arc definition. The arc is defined an arc along the ellipses that fits into rect starting at startAngle and an arc length of sweepLength.

The function has three out parameters. The return value is the starting point of the arc. The curves array represents the list of cubicTo elements up to a maximum of point_count. There are of course 3 points pr curve.

Definition at line 816 of file qstroker.cpp.

References QBezier::fromPoints(), i, j, Q_ASSERT, qFloor(), qFuzzyCompare(), qFuzzyIsNull(), qt_find_ellipse_coords(), qt_is_nan(), QT_PATH_KAPPA, qt_t_for_arc_angle(), qWarning, and rect.

Referenced by QPainterPath::addEllipse(), QPainterPath::arcTo(), QPaintEngineEx::drawEllipse(), QStroker::joinPoints(), and QStrokerOps::strokeEllipse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_find_ellipse_coords()

Q_GUI_EXPORT void qt_find_ellipse_coords ( const QRectF & r,
qreal angle,
qreal length,
QPointF * startPoint,
QPointF * endPoint )

Definition at line 65 of file qpainterpath.cpp.

References QBezier::coefficients(), d, i, qFloor(), QT_PATH_KAPPA, and qt_t_for_arc_angle().

Referenced by QPainterPath::arcMoveTo(), and qt_curves_for_arc().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_stroke_side()

template<class Iterator >
bool qt_stroke_side ( Iterator * it,
QStroker * stroker,
bool capFirst,
QLineF * startTangent )

Definition at line 596 of file qstroker.cpp.

References QStroker::capStyleMode(), QStrokerOps::curveThreshold(), QLineF::dx(), QLineF::dy(), QStroker::emitCubicTo(), QStroker::emitLineTo(), QStroker::emitMoveTo(), QStroker::forceOpen(), QBezier::fromPoints(), i, QStrokerOps::Element::isCurveTo(), QStrokerOps::Element::isLineTo(), it, QStroker::joinPoints(), QStroker::joinStyleMode(), line, QBezier::pt1(), Q_ASSERT, qDebug, qfixed, qt_fixed_to_real, qt_real_to_fixed, QLineF::setLength(), QBezier::shifted(), QBezier::startTangent(), QStroker::strokeWidth(), QLineF::translate(), QPointF::x(), qfixed2d::x, QStrokerOps::Element::x, QPointF::y(), qfixed2d::y, and QStrokerOps::Element::y.

Referenced by QStroker::processCurrentSubpath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_t_for_arc_angle()

qreal qt_t_for_arc_angle ( qreal angle)

For a given angle in the range [0 .. 90], finds the corresponding parameter t of the prototype cubic bezier arc segment b = fromPoints(QPointF(1, 0), QPointF(1, KAPPA), QPointF(KAPPA, 1), QPointF(0, 1));

From the bezier equation: b.pointAt(t).x() = (1-t)^3 + t*(1-t)^2 + t^2*(1-t)*KAPPA b.pointAt(t).y() = t*(1-t)^2 * KAPPA + t^2*(1-t) + t^3

Third degree coefficients: b.pointAt(t).x() = at^3 + bt^2 + ct + d where a = 2-3*KAPPA, b = 3*(KAPPA-1), c = 0, d = 1

b.pointAt(t).y() = at^3 + bt^2 + ct + d where a = 3*KAPPA-2, b = 6*KAPPA+3, c = 3*KAPPA, d = 0

Newton's method to find the zero of a function: given a function f(x) and initial guess x_0 x_1 = f(x_0) / f'(x_0) x_2 = f(x_1) / f'(x_1) etc...

Definition at line 756 of file qstroker.cpp.

References d, qCos(), qDegreesToRadians(), qFuzzyCompare(), qFuzzyIsNull(), qSin(), and QT_PATH_KAPPA.

Referenced by qt_curves_for_arc(), and qt_find_ellipse_coords().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: