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);
523 d_func()->elements <<
e;
526void QPainterPath::detach()
535void QPainterPath::ensureData_helper()
611 if ((!
d &&
size > 0) || (
d &&
d->elements.capacity() <
size)) {
628 return d->elements.capacity();
647 printf(
"QPainterPath::closeSubpath()\n");
677 printf(
"QPainterPath::moveTo() (%.2f,%.2f)\n",
p.x(),
p.y());
682 qWarning(
"QPainterPath::moveTo: Adding point with invalid coordinates, ignoring call");
693 d->require_moveTo =
false;
696 d->elements.last().x =
p.x();
697 d->elements.last().y =
p.y();
700 d->elements.append(elm);
702 d->cStart =
d->elements.size() - 1;
727 printf(
"QPainterPath::lineTo() (%.2f,%.2f)\n",
p.x(),
p.y());
732 qWarning(
"QPainterPath::lineTo: Adding point with invalid coordinates, ignoring call");
743 if (
p ==
QPointF(
d->elements.constLast()))
746 d->elements.append(elm);
748 d->convex =
d->elements.size() == 3 || (
d->elements.size() == 4 &&
d->isClosed());
785 printf(
"QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n",
786 c1.
x(), c1.
y(),
c2.x(),
c2.y(),
e.x(),
e.y());
791 qWarning(
"QPainterPath::cubicTo: Adding point with invalid coordinates, ignoring call");
805 if (
d->elements.constLast() == c1 && c1 ==
c2 &&
c2 ==
e)
813 d->elements << ce1 << ce2 << ee;
841 printf(
"QPainterPath::quadTo() (%.2f,%.2f), (%.2f,%.2f)\n",
842 c.x(),
c.y(),
e.x(),
e.y());
847 qWarning(
"QPainterPath::quadTo: Adding point with invalid coordinates, ignoring call");
862 if (prev ==
c &&
c ==
e)
865 QPointF c1((prev.
x() + 2*
c.x()) / 3, (prev.
y() + 2*
c.y()) / 3);
912 printf(
"QPainterPath::arcTo() (%.2f, %.2f, %.2f, %.2f, angle=%.2f, sweep=%.2f\n",
918 qWarning(
"QPainterPath::arcTo: Adding point with invalid coordinates, ignoring call");
934 for (
int i=0;
i<point_count;
i+=3) {
936 pts[
i+1].
x(), pts[
i+1].
y(),
937 pts[
i+2].
x(), pts[
i+2].
y());
985 return !d_ptr || d_func()->elements.
isEmpty()
1023 qWarning(
"QPainterPath::addRect: Adding point with invalid coordinates, ignoring call");
1034 bool first = d_func()->elements.
size() < 2;
1043 d_func()->elements << l1 << l2 << l3 << l4;
1044 d_func()->require_moveTo =
true;
1045 d_func()->convex =
first;
1076 d_func()->elements << elm;
1103 qWarning(
"QPainterPath::addEllipse: Adding point with invalid coordinates, ignoring call");
1114 bool first = d_func()->elements.
size() < 2;
1121 cubicTo(pts[0], pts[1], pts[2]);
1122 cubicTo(pts[3], pts[4], pts[5]);
1123 cubicTo(pts[6], pts[7], pts[8]);
1124 cubicTo(pts[9], pts[10], pts[11]);
1125 d_func()->require_moveTo =
true;
1127 d_func()->convex =
first;
1160 layout.setCacheEnabled(
true);
1163 opt.setUseDesignMetrics(
true);
1182 for (
int i = 0;
i < nItems; ++
i)
1186 for (
int i = 0;
i < nItems; ++
i) {
1187 int item = visualOrder[
i];
1197 : QTextItem::RenderFlags{});
1200 if (
f.d->underline) {
1204 if (
f.d->overline) {
1208 if (
f.d->strikeOut) {
1227 if (
other.isEmpty())
1236 d->elements.remove(
d->elements.size()-1);
1239 int cStart =
d->elements.size() +
other.d_func()->cStart;
1240 d->elements +=
other.d_func()->elements;
1243 d->require_moveTo =
other.d_func()->isClosed();
1258 if (
other.isEmpty())
1267 d->elements.remove(
d->elements.size()-1);
1270 int cStart =
d->elements.size() +
other.d_func()->cStart;
1271 int first =
d->elements.size();
1272 d->elements +=
other.d_func()->elements;
1279 d->elements.remove(
first--);
1283 if (cStart !=
first)
1341#define QT_BEZIER_A(bezier, coord) 3 * (-bezier.coord##1 \
1342 + 3*bezier.coord##2 \
1343 - 3*bezier.coord##3 \
1346#define QT_BEZIER_B(bezier, coord) 6 * (bezier.coord##1 \
1347 - 2*bezier.coord##2 \
1350#define QT_BEZIER_C(bezier, coord) 3 * (- bezier.coord##1 \
1353#define QT_BEZIER_CHECK_T(bezier, t) \
1354 if (t >= 0 && t <= 1) { \
1355 QPointF p(b.pointAt(t)); \
1356 if (p.x() < minx) minx = p.x(); \
1357 else if (p.x() > maxx) maxx = p.x(); \
1358 if (p.y() < miny) miny = p.y(); \
1359 else if (p.y() > maxy) maxy = p.y(); \
1365 qreal minx, miny, maxx, maxy;
1398 const qreal tx = bx * bx - 4 * ax * cx;
1402 qreal rcp = 1 / (2 * ax);
1403 qreal t1 = (-bx + temp) * rcp;
1406 qreal t2 = (-bx - temp) * rcp;
1432 qreal rcp = 1 / (2 * ay);
1441 return QRectF(minx, miny, maxx - minx, maxy - miny);
1457 computeBoundingRect();
1477 if (
d->dirtyControlBounds)
1478 computeControlPointRect();
1479 return d->controlBounds;
1515 rev.
moveTo(
d->elements.at(
d->elements.size()-1).x,
d->elements.at(
d->elements.size()-1).y);
1517 for (
int i=
d->elements.size()-1;
i>=1; --
i) {
1572 if (current.
size() > 1)
1573 flatCurves += current;
1593 Q_ASSERT(!
"QPainterPath::toSubpathPolygons(), bad element type");
1598 if (current.
size()>1)
1599 flatCurves += current;
1640 bounds += subpaths.
at(
i).boundingRect();
1642#ifdef QPP_FILLPOLYGONS_DEBUG
1643 printf(
"QPainterPath::toFillPolygons, subpathCount=%d\n",
count);
1644 for (
int i=0;
i<bounds.
size(); ++
i)
1653 if (subpaths.
at(
j).size() <= 2)
1663#ifdef QPP_FILLPOLYGONS_DEBUG
1664 printf(
"Intersections before flattening:\n");
1667 for (
int j = 0;
j < isects[
i].
size(); ++
j) {
1668 printf(
"%d ", isects[
i][
j]);
1677 for (
int j=0;
j<current_isects.
size(); ++
j) {
1678 int isect_j = current_isects.
at(
j);
1682 for (
int k = 0,
size = isects_j.
size(); k <
size; ++k) {
1683 int isect_k = isects_j.
at(k);
1684 if (isect_k !=
i && !isects.
at(
i).contains(isect_k)) {
1685 isects[
i] += isect_k;
1688 isects[isect_j].
clear();
1692#ifdef QPP_FILLPOLYGONS_DEBUG
1693 printf(
"Intersections after flattening:\n");
1696 for (
int j = 0;
j < isects[
i].
size(); ++
j) {
1697 printf(
"%d ", isects[
i][
j]);
1706 if (!subpath_list.
isEmpty()) {
1708 for (
int j=0;
j<subpath_list.
size(); ++
j) {
1712 buildUp += subpath.
first();
1740 }
else if (
y2 <
y1) {
1757 int *winding,
int depth = 0)
1767 if (
y >= bounds.
y() &&
y < bounds.
y() + bounds.
height()) {
1772 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound)) {
1776 if (bezier.
pt1().
x() <=
x) {
1777 (*winding) += (bezier.
pt4().
y() > bezier.
pt1().
y() ? 1 : -1);
1783 const auto halves = bezier.
split();
1804 int winding_number = 0;
1808 for (
int i=0;
i<
d->elements.size(); ++
i) {
1816 last_start = last_pt =
e;
1829 pt, &winding_number);
1841 if (last_pt != last_start)
1845 ? (winding_number != 0)
1846 : ((winding_number % 2) != 0));
1937 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
1940 const auto halves = bezier.
split();
1955 if (
depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
1958 const auto halves = bezier.
split();
1968 if ((point.
x() ==
rect.left() || point.
x() ==
rect.right()) &&
1969 (point.
y() >=
rect.top() && point.
y() <=
rect.bottom()))
1971 if ((point.
y() ==
rect.top() || point.
y() ==
rect.bottom()) &&
1972 (point.
x() >=
rect.left() && point.
x() <=
rect.right()))
1984 enum { OnRect, InsideRect, OutsideRect} edgeStatus = OnRect;
1985 for (
int i=0;
i<
path->elementCount(); ++
i) {
1995 last_start.
x(), last_start.
y(),
rect))
1997 last_start = last_pt =
e;
2026 bool contained =
rect.contains(last_pt);
2027 switch (edgeStatus) {
2037 edgeStatus = contained ? InsideRect : OutsideRect;
2041 if (last_pt == last_start)
2042 edgeStatus = OnRect;
2047 if (last_pt != last_start
2049 last_start.
x(), last_start.
y(),
rect))
2097 for (
int i=0;
i<
d->elements.size(); ++
i) {
2114 if (!d_ptr || (dx == 0 && dy == 0))
2117 int elementsLeft = d_ptr->elements.
size();
2118 if (elementsLeft <= 0)
2124 while (elementsLeft--) {
2150 copy.translate(dx, dy);
2209 for (
int i=0;
i<
d->elements.size(); ++
i) {
2216 for (; !stop &&
i<
d->elements.size(); ++
i) {
2265 }
else if (!
d || !other_d) {
2272 else if (
d->fillRule != other_d->fillRule)
2274 else if (
d->elements.size() != other_d->elements.
size())
2280 epsilon.rwidth() *= qt_epsilon;
2281 epsilon.rheight() *= qt_epsilon;
2283 for (
int i = 0;
i <
d->elements.size(); ++
i)
2284 if (
d->elements.at(
i).type != other_d->elements.
at(
i).
type
2302 return !(*
this==
path);
2363 return *
this = (*
this &
other);
2375 return *
this = (*
this |
other);
2388 return *
this = (*
this +
other);
2401 return *
this = (*
this -
other);
2404#ifndef QT_NO_DATASTREAM
2421 s <<
p.elementCount();
2425 s << double(
e.x) << double(
e.y);
2427 s <<
p.d_func()->cStart;
2428 s << int(
p.d_func()->fillRule);
2443 bool errorDetected =
false;
2451 if (
p.d_func()->elements.size() == 1) {
2453 p.d_func()->elements.clear();
2464 qWarning(
"QDataStream::operator>>: Invalid QPainterPath coordinates read, skipping it");
2466 errorDetected =
true;
2470 p.d_func()->elements.append(elm);
2472 s >>
p.d_func()->cStart;
2477 p.d_func()->dirtyBounds =
true;
2478 p.d_func()->dirtyControlBounds =
true;
2624 if (
d->dashPattern.isEmpty()) {
2667 d_func()->stroker.setCapStyle(style);
2676 return d_func()->stroker.capStyle();
2684 d_func()->stroker.setJoinStyle(style);
2692 return d_func()->stroker.joinStyle();
2767 d_func()->dashPattern.clear();
2777 return d_func()->dashPattern;
2785 return d_func()->dashOffset;
2796 d_func()->dashOffset =
offset;
2821 for (
int i=0;
i<flats.
size(); ++
i) {
2823 if (!flats.
at(
i).isClosed())
2834 return 3*
t*
t*(
d - 3*
c + 3*
b -
a) + 6*
t*(
c - 2*
b +
a) + 3*(
b -
a);
2847 for (
int i=1;
i<
d->elements.size(); ++
i) {
2862 d->elements.at(
i+1),
2863 d->elements.at(
i+2));
2890 if (
len > totalLength)
2894 for (
int i=1;
i<
d->elements.size(); ++
i) {
2905 if (curLen >=
len) {
2906 return len/totalLength ;
2915 d->elements.at(
i+1),
2916 d->elements.at(
i+2));
2918 qreal prevLen = curLen;
2921 if (curLen >=
len) {
2923 return (
res * blen + prevLen)/totalLength;
2939 *startingLength = 0;
2946 const int lastElement =
path.elementCount() - 1;
2947 for (
int i=0;
i <= lastElement; ++
i) {
2958 if (
i == lastElement || curLen/totalLength >=
t) {
2959 *bezierLength = llen;
2970 path.elementAt(
i+1),
2971 path.elementAt(
i+2));
2975 if (
i + 2 == lastElement || curLen/totalLength >=
t) {
2976 *bezierLength = blen;
2986 *startingLength = curLen;
3002 if (t < 0 || t > 1) {
3003 qWarning(
"QPainterPath::pointAtPercent accepts only values between 0 and 1");
3007 if (!d_ptr || d_ptr->elements.
size() == 0)
3010 if (d_ptr->elements.
size() == 1)
3011 return d_ptr->elements.
at(0);
3015 qreal bezierLen = 0;
3017 qreal realT = (totalLength *
t - curLen) / bezierLen;
3036 if (t < 0 || t > 1) {
3037 qWarning(
"QPainterPath::angleAtPercent accepts only values between 0 and 1");
3043 qreal bezierLen = 0;
3045 qreal realT = (totalLength *
t - curLen) / bezierLen;
3065 if (t < 0 || t > 1) {
3066 qWarning(
"QPainterPath::slopeAtPercent accepts only values between 0 and 1");
3072 qreal bezierLen = 0;
3074 qreal realT = (totalLength *
t - curLen) / bezierLen;
3084 if (std::numeric_limits<qreal>::has_infinity) {
3085 slope = (m2 < 0) ? -std::numeric_limits<qreal>::infinity()
3086 : std::numeric_limits<qreal>::infinity();
3088 if (
sizeof(
qreal) ==
sizeof(
double)) {
3089 return 1.79769313486231570e+308;
3091 return ((
qreal)3.40282346638528860e+38);
3127 xRadius = 100 *
qMin(xRadius,
w) /
w;
3132 yRadius = 100 *
qMin(yRadius,
h) /
h;
3142 if (xRadius <= 0 || yRadius <= 0) {
3151 qreal rxx2 =
w*xRadius/100;
3152 qreal ryy2 =
h*yRadius/100;
3157 bool first = d_func()->elements.
size() < 2;
3160 arcTo(
x,
y, rxx2, ryy2, 180, -90);
3161 arcTo(
x+
w-rxx2,
y, rxx2, ryy2, 90, -90);
3162 arcTo(
x+
w-rxx2,
y+
h-ryy2, rxx2, ryy2, 0, -90);
3163 arcTo(
x,
y+
h-ryy2, rxx2, ryy2, 270, -90);
3166 d_func()->require_moveTo =
true;
3167 d_func()->convex =
first;
3261 if (
p.elementCount() == 1)
3283 if (
p.elementCount() == 1)
3291void QPainterPath::setDirty(
bool dirty)
3293 d_func()->dirtyBounds = dirty;
3294 d_func()->dirtyControlBounds = dirty;
3295 d_func()->pathConverter.reset();
3296 d_func()->convex =
false;
3299void QPainterPath::computeBoundingRect()
const
3302 d->dirtyBounds =
false;
3308 qreal minx, maxx, miny, maxy;
3309 minx = maxx =
d->elements.at(0).x;
3310 miny = maxy =
d->elements.at(0).y;
3311 for (
int i=1;
i<
d->elements.size(); ++
i) {
3312 const Element &
e =
d->elements.at(
i);
3317 if (
e.x > maxx) maxx =
e.x;
3318 else if (
e.x < minx) minx =
e.x;
3319 if (
e.y > maxy) maxy =
e.y;
3320 else if (
e.y < miny) miny =
e.y;
3326 d->elements.at(
i+1),
3327 d->elements.at(
i+2));
3331 if (
r.x() < minx) minx =
r.x();
3333 if (
r.y() < miny) miny =
r.y();
3342 d->bounds =
QRectF(minx, miny, maxx - minx, maxy - miny);
3346void QPainterPath::computeControlPointRect()
const
3349 d->dirtyControlBounds =
false;
3351 d->controlBounds =
QRect();
3355 qreal minx, maxx, miny, maxy;
3356 minx = maxx =
d->elements.at(0).x;
3357 miny = maxy =
d->elements.at(0).y;
3358 for (
int i=1;
i<
d->elements.size(); ++
i) {
3359 const Element &
e =
d->elements.at(
i);
3360 if (
e.x > maxx) maxx =
e.x;
3361 else if (
e.x < minx) minx =
e.x;
3362 if (
e.y > maxy) maxy =
e.y;
3363 else if (
e.y < miny) miny =
e.y;
3365 d->controlBounds =
QRectF(minx, miny, maxx - minx, maxy - miny);
3368#ifndef QT_NO_DEBUG_STREAM
3371 s.nospace() <<
"QPainterPath: Element count=" <<
p.elementCount() <<
Qt::endl;
3372 const char *
types[] = {
"MoveTo",
"LineTo",
"CurveTo",
"CurveToData"};
3373 for (
int i=0;
i<
p.elementCount(); ++
i) {
3374 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...
virtual QFixed ascent() const
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
virtual QFixed lineThickness() const
virtual QFixed underlinePosition() const
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 resize(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)
QPainterPath clip(Operation op=BoolAnd)
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.
bool isClosed() const
Returns true if the polygon is closed; otherwise returns false.
\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.
bool intersects(const QRectF &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e.
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.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
qsizetype length() const
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
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
[4]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
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