17#include <private/qbezier_p.h>
18#include <private/qfontengine_p.h>
19#include <private/qnumeric_p.h>
20#include <private/qobject_p.h>
21#include <private/qpathclipper_p.h>
22#include <private/qstroker_p.h>
23#include <private/qtextengine_p.h>
28#include <performance.h>
39 if (
sizeof(
qreal) >=
sizeof(
double))
82 for (
int i = 0;
i < 2; ++
i) {
89 int quadrant = int(
t);
103 if (quadrant == 1 || quadrant == 2)
107 if (quadrant == 0 || quadrant == 1)
117 const char *
names[] = {
124 printf(
"\nQPainterPath: elementCount=%d\n",
path.elementCount());
125 for (
int i=0;
i<
path.elementCount(); ++
i) {
128 printf(
" - %3d:: %s, (%.2f, %.2f)\n",
i,
names[e.
type], e.
x, e.
y);
453 return d_ptr ? d_ptr->elements.
size() : 0;
468 return d_ptr->elements.
at(
i);
524void QPainterPath::detach()
533void QPainterPath::ensureData_helper()
609 if ((!
d &&
size > 0) || (
d &&
d->elements.capacity() <
size)) {
626 return d->elements.capacity();
645 printf(
"QPainterPath::closeSubpath()\n");
675 printf(
"QPainterPath::moveTo() (%.2f,%.2f)\n",
p.x(),
p.y());
680 qWarning(
"QPainterPath::moveTo: Adding point with invalid coordinates, ignoring call");
691 d->require_moveTo =
false;
694 d->elements.last().x =
p.x();
695 d->elements.last().y =
p.y();
698 d->elements.append(elm);
700 d->cStart =
d->elements.size() - 1;
725 printf(
"QPainterPath::lineTo() (%.2f,%.2f)\n",
p.x(),
p.y());
730 qWarning(
"QPainterPath::lineTo: Adding point with invalid coordinates, ignoring call");
741 if (
p ==
QPointF(
d->elements.constLast()))
744 d->elements.append(elm);
746 d->convex =
d->elements.size() == 3 || (
d->elements.size() == 4 &&
d->isClosed());
783 printf(
"QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n",
784 c1.
x(), c1.
y(),
c2.x(),
c2.y(), e.
x(), e.
y());
789 qWarning(
"QPainterPath::cubicTo: Adding point with invalid coordinates, ignoring call");
803 if (
d->elements.constLast() == c1 && c1 ==
c2 &&
c2 == e)
811 d->elements << ce1 << ce2 << ee;
839 printf(
"QPainterPath::quadTo() (%.2f,%.2f), (%.2f,%.2f)\n",
840 c.x(),
c.y(), e.
x(), e.
y());
845 qWarning(
"QPainterPath::quadTo: Adding point with invalid coordinates, ignoring call");
860 if (prev ==
c &&
c == e)
863 QPointF c1((prev.
x() + 2*
c.x()) / 3, (prev.
y() + 2*
c.y()) / 3);
910 printf(
"QPainterPath::arcTo() (%.2f, %.2f, %.2f, %.2f, angle=%.2f, sweep=%.2f\n",
916 qWarning(
"QPainterPath::arcTo: Adding point with invalid coordinates, ignoring call");
932 for (
int i=0;
i<point_count;
i+=3) {
934 pts[
i+1].
x(), pts[
i+1].
y(),
935 pts[
i+2].
x(), pts[
i+2].
y());
983 return !d_ptr || d_func()->elements.
isEmpty()
1021 qWarning(
"QPainterPath::addRect: Adding point with invalid coordinates, ignoring call");
1032 bool first = d_func()->elements.
size() < 2;
1041 d_func()->elements << l1 << l2 << l3 << l4;
1042 d_func()->require_moveTo =
true;
1043 d_func()->convex =
first;
1074 d_func()->elements << elm;
1101 qWarning(
"QPainterPath::addEllipse: Adding point with invalid coordinates, ignoring call");
1112 bool first = d_func()->elements.
size() < 2;
1119 cubicTo(pts[0], pts[1], pts[2]);
1120 cubicTo(pts[3], pts[4], pts[5]);
1121 cubicTo(pts[6], pts[7], pts[8]);
1122 cubicTo(pts[9], pts[10], pts[11]);
1123 d_func()->require_moveTo =
true;
1125 d_func()->convex =
first;
1158 layout.setCacheEnabled(
true);
1161 opt.setUseDesignMetrics(
true);
1178 QVarLengthArray<int> visualOrder(nItems);
1179 QVarLengthArray<uchar>
levels(nItems);
1180 for (
int i = 0;
i < nItems; ++
i)
1184 for (
int i = 0;
i < nItems; ++
i) {
1185 int item = visualOrder[
i];
1192 fe->addOutlineToPath(
x,
y, glyphs,
this,
1195 : QTextItem::RenderFlags{});
1197 const qreal lw = fe->lineThickness().toReal();
1198 if (
f.d->underline) {
1199 qreal pos = fe->underlinePosition().toReal();
1202 if (
f.d->overline) {
1203 qreal pos = fe->ascent().toReal() + 1;
1206 if (
f.d->strikeOut) {
1207 qreal pos = fe->ascent().toReal() / 3;
1225 if (
other.isEmpty())
1234 d->elements.remove(
d->elements.size()-1);
1237 int cStart =
d->elements.size() +
other.d_func()->cStart;
1238 d->elements +=
other.d_func()->elements;
1241 d->require_moveTo =
other.d_func()->isClosed();
1256 if (
other.isEmpty())
1265 d->elements.remove(
d->elements.size()-1);
1268 int cStart =
d->elements.size() +
other.d_func()->cStart;
1269 int first =
d->elements.size();
1270 d->elements +=
other.d_func()->elements;
1277 d->elements.remove(
first--);
1281 if (cStart !=
first)
1339#define QT_BEZIER_A(bezier, coord) 3 * (-bezier.coord##1 \
1340 + 3*bezier.coord##2 \
1341 - 3*bezier.coord##3 \
1344#define QT_BEZIER_B(bezier, coord) 6 * (bezier.coord##1 \
1345 - 2*bezier.coord##2 \
1348#define QT_BEZIER_C(bezier, coord) 3 * (- bezier.coord##1 \
1351#define QT_BEZIER_CHECK_T(bezier, t) \
1352 if (t >= 0 && t <= 1) { \
1353 QPointF p(b.pointAt(t)); \
1354 if (p.x() < minx) minx = p.x(); \
1355 else if (p.x() > maxx) maxx = p.x(); \
1356 if (p.y() < miny) miny = p.y(); \
1357 else if (p.y() > maxy) maxy = p.y(); \
1363 qreal minx, miny, maxx, maxy;
1396 const qreal tx = bx * bx - 4 * ax * cx;
1400 qreal rcp = 1 / (2 * ax);
1401 qreal t1 = (-bx + temp) * rcp;
1404 qreal t2 = (-bx - temp) * rcp;
1430 qreal rcp = 1 / (2 * ay);
1439 return QRectF(minx, miny, maxx - minx, maxy - miny);
1455 computeBoundingRect();
1475 if (
d->dirtyControlBounds)
1476 computeControlPointRect();
1477 return d->controlBounds;
1513 rev.
moveTo(
d->elements.at(
d->elements.size()-1).x,
d->elements.at(
d->elements.size()-1).y);
1515 for (
int i=
d->elements.size()-1;
i>=1; --
i) {
1520 rev.lineTo(prev.
x, prev.
y);
1523 rev.moveTo(prev.
x, prev.
y);
1532 rev.cubicTo(prev.
x, prev.
y, cp1.x, cp1.y,
sp.x,
sp.y);
1561 QList<QPolygonF> flatCurves;
1570 if (current.
size() > 1)
1571 flatCurves += current;
1591 Q_ASSERT(!
"QPainterPath::toSubpathPolygons(), bad element type");
1596 if (current.
size()>1)
1597 flatCurves += current;
1627 QList<QPolygonF> polys;
1630 int count = subpaths.size();
1635 QList<QRectF> bounds;
1636 bounds.reserve(
count);
1638 bounds += subpaths.at(
i).boundingRect();
1640#ifdef QPP_FILLPOLYGONS_DEBUG
1641 printf(
"QPainterPath::toFillPolygons, subpathCount=%d\n",
count);
1642 for (
int i=0;
i<bounds.size(); ++
i)
1643 qDebug() <<
" bounds" <<
i << bounds.at(
i);
1646 QList< QList<int> > isects;
1647 isects.resize(
count);
1651 if (subpaths.at(
j).size() <= 2)
1653 QRectF cbounds = bounds.at(
j);
1655 if (cbounds.intersects(bounds.at(
i))) {
1661#ifdef QPP_FILLPOLYGONS_DEBUG
1662 printf(
"Intersections before flattening:\n");
1665 for (
int j = 0;
j < isects[
i].size(); ++
j) {
1666 printf(
"%d ", isects[
i][
j]);
1674 const QList<int> ¤t_isects = isects.at(
i);
1675 for (
int j=0;
j<current_isects.size(); ++
j) {
1676 int isect_j = current_isects.at(
j);
1679 const QList<int> &isects_j = isects.at(isect_j);
1680 for (
int k = 0,
size = isects_j.size(); k <
size; ++k) {
1681 int isect_k = isects_j.at(k);
1682 if (isect_k !=
i && !isects.at(
i).contains(isect_k)) {
1683 isects[
i] += isect_k;
1686 isects[isect_j].clear();
1690#ifdef QPP_FILLPOLYGONS_DEBUG
1691 printf(
"Intersections after flattening:\n");
1694 for (
int j = 0;
j < isects[
i].size(); ++
j) {
1695 printf(
"%d ", isects[
i][
j]);
1703 const QList<int> &subpath_list = isects.at(
i);
1704 if (!subpath_list.isEmpty()) {
1706 for (
int j=0;
j<subpath_list.size(); ++
j) {
1707 const QPolygonF &subpath = subpaths.
at(subpath_list.at(
j));
1709 if (!subpath.isClosed())
1710 buildUp += subpath.first();
1711 if (!buildUp.isClosed())
1712 buildUp += buildUp.constFirst();
1738 }
else if (
y2 <
y1) {
1755 int *winding,
int depth = 0)
1765 if (
y >= bounds.
y() &&
y < bounds.
y() + bounds.
height()) {
1770 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound)) {
1774 if (bezier.
pt1().
x() <=
x) {
1775 (*winding) += (bezier.
pt4().
y() > bezier.
pt1().
y() ? 1 : -1);
1781 const auto halves = bezier.
split();
1802 int winding_number = 0;
1806 for (
int i=0;
i<
d->elements.size(); ++
i) {
1814 last_start = last_pt = e;
1827 pt, &winding_number);
1839 if (last_pt != last_start)
1843 ? (winding_number != 0)
1844 : ((winding_number % 2) != 0));
1935 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
1938 const auto halves = bezier.
split();
1953 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
1956 const auto halves = bezier.
split();
1966 if ((point.
x() ==
rect.left() || point.
x() ==
rect.right()) &&
1967 (point.
y() >=
rect.top() && point.
y() <=
rect.bottom()))
1969 if ((point.
y() ==
rect.top() || point.
y() ==
rect.bottom()) &&
1970 (point.
x() >=
rect.left() && point.
x() <=
rect.right()))
1982 enum { OnRect, InsideRect, OutsideRect} edgeStatus = OnRect;
1983 for (
int i=0;
i<
path->elementCount(); ++
i) {
1993 last_start.x(), last_start.y(),
rect))
1995 last_start = last_pt = e;
2024 bool contained =
rect.contains(last_pt);
2025 switch (edgeStatus) {
2035 edgeStatus = contained ? InsideRect : OutsideRect;
2039 if (last_pt == last_start)
2040 edgeStatus = OnRect;
2045 if (last_pt != last_start
2047 last_start.x(), last_start.y(),
rect))
2095 for (
int i=0;
i<
d->elements.size(); ++
i) {
2112 if (!d_ptr || (dx == 0 && dy == 0))
2115 int elementsLeft = d_ptr->elements.
size();
2116 if (elementsLeft <= 0)
2122 while (elementsLeft--) {
2148 copy.translate(dx, dy);
2207 for (
int i=0;
i<
d->elements.size(); ++
i) {
2214 for (; !stop &&
i<
d->elements.size(); ++
i) {
2263 }
else if (!
d || !other_d) {
2270 else if (
d->fillRule != other_d->fillRule)
2272 else if (
d->elements.size() != other_d->elements.size())
2275 const qreal qt_epsilon =
sizeof(
qreal) ==
sizeof(
double) ? 1e-12 :
qreal(1e-5);
2278 epsilon.rwidth() *= qt_epsilon;
2279 epsilon.rheight() *= qt_epsilon;
2281 for (
int i = 0;
i <
d->elements.size(); ++
i)
2282 if (
d->elements.at(
i).type != other_d->elements.at(
i).type
2300 return !(*
this==
path);
2361 return *
this = (*
this &
other);
2373 return *
this = (*
this |
other);
2386 return *
this = (*
this +
other);
2399 return *
this = (*
this -
other);
2402#ifndef QT_NO_DATASTREAM
2419 s <<
p.elementCount();
2423 s << double(e.
x) << double(e.
y);
2425 s <<
p.d_func()->cStart;
2426 s << int(
p.d_func()->fillRule);
2441 bool errorDetected =
false;
2452 p.d_func()->elements.clear();
2462 qWarning(
"QDataStream::operator>>: Invalid QPainterPath coordinates read, skipping it");
2464 errorDetected =
true;
2468 p.d_func()->elements.append(elm);
2470 s >>
p.d_func()->cStart;
2475 if (errorDetected ||
p.d_func()->elements.isEmpty())
2620 if (
d->dashPattern.isEmpty()) {
2663 d_func()->stroker.setCapStyle(style);
2672 return d_func()->stroker.capStyle();
2680 d_func()->stroker.setJoinStyle(style);
2688 return d_func()->stroker.joinStyle();
2763 d_func()->dashPattern.clear();
2773 return d_func()->dashPattern;
2781 return d_func()->dashOffset;
2792 d_func()->dashOffset =
offset;
2814 if (flats.isEmpty())
2817 for (
int i=0;
i<flats.size(); ++
i) {
2819 if (!flats.at(
i).isClosed())
2830 return 3*
t*
t*(
d - 3*
c + 3*
b -
a) + 6*
t*(
c - 2*
b +
a) + 3*(
b -
a);
2843 for (
int i=1;
i<
d->elements.size(); ++
i) {
2858 d->elements.at(
i+1),
2859 d->elements.at(
i+2));
2886 if (
len > totalLength)
2890 for (
int i=1;
i<
d->elements.size(); ++
i) {
2901 if (curLen >=
len) {
2902 return len/totalLength ;
2911 d->elements.at(
i+1),
2912 d->elements.at(
i+2));
2914 qreal prevLen = curLen;
2917 if (curLen >=
len) {
2919 return (
res * blen + prevLen)/totalLength;
2935 *startingLength = 0;
2942 const int lastElement =
path.elementCount() - 1;
2943 for (
int i=0;
i <= lastElement; ++
i) {
2954 if (
i == lastElement || curLen/totalLength >=
t) {
2955 *bezierLength = llen;
2966 path.elementAt(
i+1),
2967 path.elementAt(
i+2));
2971 if (
i + 2 == lastElement || curLen/totalLength >=
t) {
2972 *bezierLength = blen;
2982 *startingLength = curLen;
2998 if (t < 0 || t > 1) {
2999 qWarning(
"QPainterPath::pointAtPercent accepts only values between 0 and 1");
3003 if (!d_ptr || d_ptr->elements.
size() == 0)
3006 if (d_ptr->elements.
size() == 1)
3007 return d_ptr->elements.
at(0);
3011 qreal bezierLen = 0;
3013 qreal realT = (totalLength *
t - curLen) / bezierLen;
3032 if (t < 0 || t > 1) {
3033 qWarning(
"QPainterPath::angleAtPercent accepts only values between 0 and 1");
3039 qreal bezierLen = 0;
3041 qreal realT = (totalLength *
t - curLen) / bezierLen;
3043 qreal m1 =
slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4);
3044 qreal m2 =
slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4);
3061 if (t < 0 || t > 1) {
3062 qWarning(
"QPainterPath::slopeAtPercent accepts only values between 0 and 1");
3068 qreal bezierLen = 0;
3070 qreal realT = (totalLength *
t - curLen) / bezierLen;
3072 qreal m1 =
slopeAt(realT, bez.x1, bez.x2, bez.x3, bez.x4);
3073 qreal m2 =
slopeAt(realT, bez.y1, bez.y2, bez.y3, bez.y4);
3080 if (std::numeric_limits<qreal>::has_infinity) {
3081 slope = (m2 < 0) ? -std::numeric_limits<qreal>::infinity()
3082 : std::numeric_limits<qreal>::infinity();
3084 if (
sizeof(
qreal) ==
sizeof(
double)) {
3085 return 1.79769313486231570e+308;
3087 return ((
qreal)3.40282346638528860e+38);
3123 xRadius = 100 *
qMin(xRadius,
w) /
w;
3128 yRadius = 100 *
qMin(yRadius,
h) /
h;
3138 if (xRadius <= 0 || yRadius <= 0) {
3147 qreal rxx2 =
w*xRadius/100;
3148 qreal ryy2 =
h*yRadius/100;
3153 bool first = d_func()->elements.
size() < 2;
3156 arcTo(
x,
y, rxx2, ryy2, 180, -90);
3157 arcTo(
x+
w-rxx2,
y, rxx2, ryy2, 90, -90);
3158 arcTo(
x+
w-rxx2,
y+
h-ryy2, rxx2, ryy2, 0, -90);
3159 arcTo(
x,
y+
h-ryy2, rxx2, ryy2, 270, -90);
3162 d_func()->require_moveTo =
true;
3163 d_func()->convex =
first;
3257 if (
p.elementCount() == 1)
3262 return clipper.intersect();
3279 if (
p.elementCount() == 1)
3284 return clipper.contains();
3287void QPainterPath::setDirty(
bool dirty)
3289 d_func()->dirtyBounds = dirty;
3290 d_func()->dirtyControlBounds = dirty;
3291 d_func()->pathConverter.reset();
3292 d_func()->convex =
false;
3295void QPainterPath::computeBoundingRect()
const
3298 d->dirtyBounds =
false;
3304 qreal minx, maxx, miny, maxy;
3305 minx = maxx =
d->elements.at(0).x;
3306 miny = maxy =
d->elements.at(0).y;
3307 for (
int i=1;
i<
d->elements.size(); ++
i) {
3313 if (e.
x > maxx) maxx = e.
x;
3314 else if (e.
x < minx) minx = e.
x;
3315 if (e.
y > maxy) maxy = e.
y;
3316 else if (e.
y < miny) miny = e.
y;
3322 d->elements.at(
i+1),
3323 d->elements.at(
i+2));
3327 if (
r.x() < minx) minx =
r.x();
3329 if (
r.y() < miny) miny =
r.y();
3338 d->bounds =
QRectF(minx, miny, maxx - minx, maxy - miny);
3342void QPainterPath::computeControlPointRect()
const
3345 d->dirtyControlBounds =
false;
3347 d->controlBounds =
QRect();
3351 qreal minx, maxx, miny, maxy;
3352 minx = maxx =
d->elements.at(0).x;
3353 miny = maxy =
d->elements.at(0).y;
3354 for (
int i=1;
i<
d->elements.size(); ++
i) {
3356 if (e.
x > maxx) maxx = e.
x;
3357 else if (e.
x < minx) minx = e.
x;
3358 if (e.
y > maxy) maxy = e.
y;
3359 else if (e.
y < miny) miny = e.
y;
3361 d->controlBounds =
QRectF(minx, miny, maxx - minx, maxy - miny);
3364#ifndef QT_NO_DEBUG_STREAM
3367 s.nospace() <<
"QPainterPath: Element count=" <<
p.elementCount() <<
Qt::endl;
3368 const char *
types[] = {
"MoveTo",
"LineTo",
"CurveTo",
"CurveToData"};
3369 for (
int i=0;
i<
p.elementCount(); ++
i) {
3370 s.nospace() <<
" -> " <<
types[
p.elementAt(
i).type] <<
"(x=" <<
p.elementAt(
i).x <<
", y=" <<
p.elementAt(
i).y <<
')' <<
Qt::endl;
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
std::pair< QBezier, QBezier > split() const
static void coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &d)
void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold=0.5) const
void setDashPattern(const QList< qfixed > &dashPattern)
void setDashOffset(qreal offset)
static QList< qfixed > patternForStyle(Qt::PenStyle style)
\inmodule QtCore\reentrant
void reset(T *ptr=nullptr) noexcept
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
qreal length() const
Returns the length of the line.
qsizetype size() const noexcept
bool isEmpty() const noexcept
const_reference at(qsizetype i) const noexcept
const T & constFirst() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
QPainterPathStrokerPrivate()
The QPainterPathStroker class is used to generate fillable outlines for a given painter path.
void setCurveThreshold(qreal threshold)
Specifies the curve flattening threshold, controlling the granularity with which the generated outlin...
Qt::PenJoinStyle joinStyle() const
Returns the join style of the generated outlines.
QList< qreal > dashPattern() const
Returns the dash pattern for the generated outlines.
void setDashPattern(Qt::PenStyle)
Sets the dash pattern for the generated outlines to style.
qreal miterLimit() const
Returns the miter limit for the generated outlines.
qreal curveThreshold() const
Returns the curve flattening threshold for the generated outlines.
Qt::PenCapStyle capStyle() const
Returns the cap style of the generated outlines.
~QPainterPathStroker()
Destroys the stroker.
qreal width() const
Returns the width of the generated outlines.
void setDashOffset(qreal offset)
Sets the dash offset for the generated outlines to offset.
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path.
QPainterPathStroker()
Creates a new stroker.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
qreal dashOffset() const
Returns the dash offset for the generated outlines.
void setMiterLimit(qreal length)
Sets the miter limit of the generated outlines to limit.
void quadTo(const QPointF &ctrlPt, const QPointF &endPt)
Adds a quadratic Bezier curve between the current position and the given endPoint with the control po...
int capacity() const
Returns the number of elements allocated by the QPainterPath.
QPainterPath operator-(const QPainterPath &other) const
QPainterPath translated(qreal dx, qreal dy) const
Returns a copy of the path that is translated by ({dx}, {dy}).
void translate(qreal dx, qreal dy)
Translates all elements in the path by ({dx}, {dy}).
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
QList< QPolygonF > toSubpathPolygons(const QTransform &matrix=QTransform()) const
Converts the path into a list of polygons using the QTransform matrix, and returns the list.
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
~QPainterPath()
Destroys this QPainterPath object.
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
qreal angleAtPercent(qreal t) const
Returns the angle of the path tangent at the percentage t.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
void setElementPositionAt(int i, qreal x, qreal y)
QPainterPath subtracted(const QPainterPath &r) const
QPainterPath & operator=(const QPainterPath &other)
Assigns the given path to this painter path.
QPainterPath operator+(const QPainterPath &other) const
QPainterPath::Element elementAt(int i) const
Returns the element at the given index in the painter path.
QPainterPath() noexcept
Constructs an empty QPainterPath object.
void connectPath(const QPainterPath &path)
Connects the given path to this path by adding a line from the last element of this path to the first...
int elementCount() const
Returns the number of path elements in the painter path.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
QPainterPath & operator&=(const QPainterPath &other)
QPainterPath simplified() const
void addPath(const QPainterPath &path)
Adds the given path to this path as a closed subpath.
QPolygonF toFillPolygon(const QTransform &matrix=QTransform()) const
Converts the path into a polygon using the QTransform matrix, and returns the polygon.
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
QPainterPath & operator|=(const QPainterPath &other)
bool intersects(const QRectF &rect) const
Returns true if any point in the given rectangle intersects the path; otherwise returns false.
QList< QPolygonF > toFillPolygons(const QTransform &matrix=QTransform()) const
Converts the path into a list of polygons using the QTransform matrix, and returns the list.
void clear()
Clears the path elements stored.
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision.
bool contains(const QPointF &pt) const
Returns true if the given point is inside the path, otherwise returns false.
bool operator!=(const QPainterPath &other) const
Returns true if this painter path differs from the given path.
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
QPointF pointAtPercent(qreal t) const
Returns the point at at the percentage t of the current path.
QPainterPath united(const QPainterPath &r) const
void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
void reserve(int size)
Reserves a given amount of elements in QPainterPath's internal memory.
QPainterPath & operator-=(const QPainterPath &other)
void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength)
Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending...
QPainterPath operator|(const QPainterPath &other) const
bool operator==(const QPainterPath &other) const
Returns true if this painterpath is equal to the given path.
QPainterPath intersected(const QPainterPath &r) const
qreal percentAtLength(qreal t) const
Returns percentage of the whole path at the specified length len.
QPainterPath toReversed() const
Creates and returns a reversed copy of the path.
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
QPainterPath & operator+=(const QPainterPath &other)
qreal slopeAtPercent(qreal t) const
Returns the slope of the path at the percentage t.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
void addText(const QPointF &point, const QFont &f, const QString &text)
Adds the given text to this path as a set of closed subpaths created from the font supplied.
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
QPointF currentPosition() const
Returns the current position of the path.
qreal length() const
Returns the length of the current path.
void swap(QPainterPath &other) noexcept
void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt)
Adds a cubic Bezier curve between the current position and the given endPoint using the control point...
void addRegion(const QRegion ®ion)
Adds the given region to the path by adding each rectangle in the region as a separate closed subpath...
QPainterPath operator&(const QPainterPath &other) const
void arcMoveTo(const QRectF &rect, qreal angle)
qreal widthF() const
Returns the pen width with floating point precision.
QList< qreal > dashPattern() const
Returns the dash pattern of this pen.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
qreal miterLimit() const
Returns the miter limit of the pen.
qreal dashOffset() const
Returns the dash offset for the pen.
Qt::PenStyle style() const
Returns the pen style.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
The QPolygonF class provides a list of points using floating point precision.
\inmodule QtCore\reentrant
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
QRectF normalized() const noexcept
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
constexpr QChar at(qsizetype n) const noexcept
Returns the character at position n in this string view.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
qsizetype length() const noexcept
Returns the number of characters in this string.
void setCubicToHook(qStrokerCubicToHook cubicToHook)
void setMoveToHook(qStrokerMoveToHook moveToHook)
void strokePath(const QPainterPath &path, void *data, const QTransform &matrix)
Convenience function that decomposes path into begin(), moveTo(), lineTo(), curevTo() and end() calls...
void setLineToHook(qStrokerLineToHook lineToHook)
void setClipRect(const QRectF &clip)
QGlyphLayout shapedGlyphs(const QScriptItem *si) const
QFontEngine * fontEngine(const QScriptItem &si, QFixed *ascent=nullptr, QFixed *descent=nullptr, QFixed *leading=nullptr) const
static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder)
Combined button and popup list for selecting options.
QTextStream & endl(QTextStream &stream)
Writes '\n' to the stream and flushes the stream.
static jboolean copy(JNIEnv *, jobject)
bool qIsFinite(qfloat16 f) noexcept
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
qfloat16 qSqrt(qfloat16 f)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qBound(const T &min, const T &val, const T &max)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLsizei GLenum GLenum * types
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
GLfixed GLfixed GLfixed y2
GLsizei const GLchar *const * path
static const QRectF boundingRect(const QPointF *points, int pointCount)
static QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *startingLength, qreal *bezierLength)
static qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)
void qt_path_stroke_move_to(qfixed x, qfixed y, void *data)
static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF &rect)
QDataStream & operator<<(QDataStream &s, const QPainterPath &p)
static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth=0)
static void qt_painterpath_isect_line(const QPointF &p1, const QPointF &p2, const QPointF &pos, int *winding)
static QRectF qt_painterpath_bezier_extrema(const QBezier &b)
#define QT_BEZIER_CHECK_T(bezier, t)
static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y2, const QRectF &rect)
#define QT_BEZIER_C(bezier, coord)
void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, QPointF *startPoint, QPointF *endPoint)
QDataStream & operator>>(QDataStream &s, QPainterPath &p)
void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey, void *data)
#define QT_BEZIER_A(bezier, coord)
static bool epsilonCompare(const QPointF &a, const QPointF &b, const QSizeF &epsilon)
#define QT_BEZIER_B(bezier, coord)
static QT_BEGIN_NAMESPACE bool isValidCoord(qreal c)
static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, int *winding, int depth=0)
static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth=0)
static bool pointOnEdge(const QRectF &rect, const QPointF &point)
QPainterPath qt_stroke_dash(const QPainterPath &path, qreal *dashes, int dashCount)
static bool hasValidCoords(QPointF p)
void qt_path_stroke_line_to(qfixed x, qfixed y, void *data)
static const qreal epsilon
qreal qt_t_for_arc_angle(qreal angle)
QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLength, QPointF *curves, int *point_count)
#define qt_fixed_to_real(fixed)
#define qt_real_to_fixed(real)
QT_BEGIN_NAMESPACE typedef qreal qfixed
static const QTextHtmlElement elements[Html_NumElements]
constexpr qreal toReal() const