56 #include <private/qbezier_p.h> 57 #include <private/qfontengine_p.h> 58 #include <private/qnumeric_p.h> 59 #include <private/qobject_p.h> 60 #include <private/qpathclipper_p.h> 61 #include <private/qstroker_p.h> 62 #include <private/qtextengine_p.h> 67 #include <performance.h> 83 delete static_cast<QPainterPathData *>(d);
112 QPointF *points[2] = { startPoint, endPoint };
114 for (
int i = 0; i < 2; ++i) {
118 qreal theta = angles[i] - 360 *
qFloor(angles[i] / 360);
119 qreal t = theta / 90;
121 int quadrant = int(t);
135 if (quadrant == 1 || quadrant == 2)
139 if (quadrant == 0 || quadrant == 1)
149 const char *names[] = {
156 printf(
"\nQPainterPath: elementCount=%d\n", path.
elementCount());
160 printf(
" - %3d:: %s, (%.2f, %.2f)\n", i, names[e.
type], e.
x, e.
y);
669 printf(
"QPainterPath::closeSubpath()\n");
705 printf(
"QPainterPath::moveTo() (%.2f,%.2f)\n", p.
x(), p.
y());
710 qWarning(
"QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call");
724 d->elements.last().x = p.
x();
725 d->elements.last().y = p.
y();
728 d->elements.append(elm);
730 d->
cStart = d->elements.size() - 1;
761 printf(
"QPainterPath::lineTo() (%.2f,%.2f)\n", p.
x(), p.
y());
766 qWarning(
"QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call");
777 if (p ==
QPointF(d->elements.last()))
780 d->elements.append(elm);
782 d->
convex = d->elements.size() == 3 || (d->elements.size() == 4 && d->
isClosed());
824 printf(
"QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n",
825 c1.
x(), c1.
y(), c2.
x(), c2.
y(), e.
x(), e.
y());
831 qWarning(
"QPainterPath::cubicTo: Adding point where x or y is NaN or Inf, ignoring call");
845 if (d->elements.last() == c1 && c1 == c2 && c2 == e)
853 d->elements << ce1 << ce2 << ee;
887 printf(
"QPainterPath::quadTo() (%.2f,%.2f), (%.2f,%.2f)\n",
888 c.
x(), c.
y(), e.
x(), e.
y());
893 qWarning(
"QPainterPath::quadTo: Adding point where x or y is NaN or Inf, ignoring call");
908 if (prev == c && c == e)
911 QPointF c1((prev.
x() + 2*c.
x()) / 3, (prev.
y() + 2*c.
y()) / 3);
912 QPointF c2((e.
x() + 2*c.
x()) / 3, (e.
y() + 2*c.
y()) / 3);
963 printf(
"QPainterPath::arcTo() (%.2f, %.2f, %.2f, %.2f, angle=%.2f, sweep=%.2f\n",
964 rect.
x(), rect.
y(), rect.
width(), rect.
height(), startAngle, sweepLength);
970 qWarning(
"QPainterPath::arcTo: Adding arc where a parameter is NaN or Inf, ignoring call");
986 for (
int i=0; i<point_count; i+=3) {
987 cubicTo(pts[i].x(), pts[i].y(),
988 pts[i+1].x(), pts[i+1].y(),
989 pts[i+2].x(), pts[i+2].y());
1089 qWarning(
"QPainterPath::addRect: Adding rect where a parameter is NaN or Inf, ignoring call");
1100 bool first =
d_func()->elements.size() < 2;
1110 d_func()->elements << l1 << l2 << l3 << l4;
1142 for (
int i=1; i<polygon.
size(); ++i) {
1144 d_func()->elements << elm;
1174 qWarning(
"QPainterPath::addEllipse: Adding ellipse where a parameter is NaN or Inf, ignoring call");
1179 if (boundingRect.
isNull())
1186 bool first =
d_func()->elements.size() < 2;
1187 d->elements.reserve(
d->elements.size() + 13);
1194 cubicTo(pts[0], pts[1], pts[2]);
1195 cubicTo(pts[3], pts[4], pts[5]);
1196 cubicTo(pts[6], pts[7], pts[8]);
1197 cubicTo(pts[9], pts[10], pts[11]);
1249 for (
int i = 0; i < nItems; ++i)
1253 for (
int i = 0; i < nItems; ++i) {
1254 int item = visualOrder[i];
1264 : QTextItem::RenderFlags(0));
1306 d->elements.remove(d->elements.size()-1);
1309 int cStart = d->elements.size() + other.
d_func()->
cStart;
1310 d->elements += other.
d_func()->elements;
1340 d->elements.remove(d->elements.size()-1);
1343 int cStart = d->elements.size() + other.
d_func()->
cStart;
1344 int first = d->elements.size();
1345 d->elements += other.
d_func()->elements;
1351 if (first > 0 &&
QPointF(d->elements[first]) ==
QPointF(d->elements[first - 1])) {
1352 d->elements.remove(first--);
1356 if (cStart != first)
1373 d_func()->elements.reserve(rects.
size() * 5);
1374 for (
int i=0; i<rects.
size(); ++i)
1412 if (
d_func()->fillRule == fillRule)
1419 #define QT_BEZIER_A(bezier, coord) 3 * (-bezier.coord##1 \ 1420 + 3*bezier.coord##2 \ 1421 - 3*bezier.coord##3 \ 1424 #define QT_BEZIER_B(bezier, coord) 6 * (bezier.coord##1 \ 1425 - 2*bezier.coord##2 \ 1428 #define QT_BEZIER_C(bezier, coord) 3 * (- bezier.coord##1 \ 1431 #define QT_BEZIER_CHECK_T(bezier, t) \ 1432 if (t >= 0 && t <= 1) { \ 1433 QPointF p(b.pointAt(t)); \ 1434 if (p.x() < minx) minx = p.x(); \ 1435 else if (p.x() > maxx) maxx = p.x(); \ 1436 if (p.y() < miny) miny = p.y(); \ 1437 else if (p.y() > maxy) maxy = p.y(); \ 1443 qreal minx, miny, maxx, maxy;
1476 const qreal tx = bx * bx - 4 * ax * cx;
1480 qreal rcp = 1 / (2 * ax);
1481 qreal t1 = (-bx + temp) * rcp;
1484 qreal t2 = (-bx - temp) * rcp;
1506 const qreal ty = by * by - 4 * ay * cy;
1510 qreal rcp = 1 / (2 * ay);
1511 qreal t1 = (-by + temp) * rcp;
1514 qreal t2 = (-by - temp) * rcp;
1519 return QRectF(minx, miny, maxx - minx, maxy - miny);
1591 rev.
moveTo(
d->elements.at(
d->elements.size()-1).x,
d->elements.at(
d->elements.size()-1).y);
1593 for (
int i=
d->elements.size()-1; i>=1; --i) {
1648 if (current.
size() > 1)
1649 flatCurves += current;
1662 QPointF(
d->elements.at(i+1).x,
d->elements.at(i+1).y) * matrix,
1663 QPointF(
d->elements.at(i+2).x,
d->elements.at(i+2).y) * matrix);
1664 bezier.addToPolygon(¤t);
1669 Q_ASSERT(!
"QPainterPath::toSubpathPolygons(), bad element type");
1674 if (current.
size()>1)
1675 flatCurves += current;
1716 int count = subpaths.
size();
1722 for (
int i=0; i<count; ++i)
1725 #ifdef QPP_FILLPOLYGONS_DEBUG 1726 printf(
"QPainterPath::toFillPolygons, subpathCount=%d\n", count);
1727 for (
int i=0; i<bounds.
size(); ++i)
1728 qDebug() <<
" bounds" << i << bounds.
at(i);
1735 for (
int j=0; j<count; ++j) {
1736 if (subpaths.
at(j).
size() <= 2)
1739 for (
int i=0; i<count; ++i) {
1746 #ifdef QPP_FILLPOLYGONS_DEBUG 1747 printf(
"Intersections before flattening:\n");
1748 for (
int i = 0; i < count; ++i) {
1750 for (
int j = 0; j < isects[i].
size(); ++j) {
1751 printf(
"%d ", isects[i][j]);
1758 for (
int i=0; i<count; ++i) {
1760 for (
int j=0; j<current_isects.
size(); ++j) {
1761 int isect_j = current_isects.
at(j);
1764 for (
int k=0; k<isects[isect_j].
size(); ++k) {
1765 int isect_k = isects[isect_j][k];
1766 if (isect_k != i && !isects.
at(i).contains(isect_k)) {
1767 isects[i] += isect_k;
1770 isects[isect_j].
clear();
1774 #ifdef QPP_FILLPOLYGONS_DEBUG 1775 printf(
"Intersections after flattening:\n");
1776 for (
int i = 0; i < count; ++i) {
1778 for (
int j = 0; j < isects[i].
size(); ++j) {
1779 printf(
"%d ", isects[i][j]);
1786 for (
int i=0; i<count; ++i) {
1788 if (!subpath_list.
isEmpty()) {
1790 for (
int j=0; j<subpath_list.
size(); ++j) {
1794 buildUp += subpath.
first();
1796 buildUp += buildUp.
first();
1830 }
else if (y2 < y1) {
1831 qreal x_tmp = x2; x2 = x1; x1 = x_tmp;
1832 qreal y_tmp = y2; y2 = y1; y1 = y_tmp;
1836 if (y >= y1 && y < y2) {
1837 qreal x = x1 + ((x2 - x1) / (y2 - y1)) * (y - y1);
1847 int *winding,
int depth = 0)
1857 if (y >= bounds.
y() && y < bounds.
y() + bounds.
height()) {
1862 if (depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound)) {
1866 if (bezier.
pt1().
x() <= x) {
1867 (*winding) += (bezier.
pt4().
y() > bezier.
pt1().
y() ? 1 : -1);
1873 QBezier first_half, second_half;
1874 bezier.
split(&first_half, &second_half);
1898 int winding_number = 0;
1902 for (
int i=0; i<d->elements.size(); ++i) {
1903 const Element &e = d->elements.at(i);
1910 last_start = last_pt = e;
1923 pt, &winding_number);
1935 if (last_pt != last_start)
1939 ? (winding_number != 0)
1940 : ((winding_number % 2) != 0));
1955 | ((y1 < top) <<
Top)
1956 | ((y1 > bottom) << Bottom);
1959 | ((y2 < top) <<
Top)
1960 | ((y2 > bottom) << Bottom);
1972 y1 += dy/dx * (left - x1);
1974 }
else if (x1 > right) {
1975 y1 -= dy/dx * (x1 -
right);
1979 y2 += dy/dx * (left - x2);
1981 }
else if (x2 > right) {
1982 y2 -= dy/dx * (x2 -
right);
1986 p1 = ((y1 < top) <<
Top)
1987 | ((y1 > bottom) << Bottom);
1988 p2 = ((y2 < top) <<
Top)
1989 | ((y2 > bottom) << Bottom);
1996 x1 += dx/dy * (top - y1);
1998 }
else if (y1 > bottom) {
1999 x1 -= dx/dy * (y1 - bottom);
2003 x2 += dx/dy * (top - y2);
2005 }
else if (y2 > bottom) {
2006 x2 -= dx/dy * (y2 - bottom);
2027 if (y >= bounds.
top() && y < bounds.
bottom()
2028 && bounds.
right() >= x1 && bounds.
left() < x2) {
2030 if (depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
2033 QBezier first_half, second_half;
2034 bezier.
split(&first_half, &second_half);
2046 if (x >= bounds.
left() && x < bounds.
right()
2047 && bounds.
bottom() >= y1 && bounds.
top() < y2) {
2049 if (depth == 32 || (bounds.
width() < lower_bound && bounds.
height() < lower_bound))
2052 QBezier first_half, second_half;
2053 bezier.
split(&first_half, &second_half);
2078 last_start.
x(), last_start.
y(), rect))
2080 last_start = last_pt = e;
2109 if (last_pt != last_start
2111 last_start.
x(), last_start.
y(), rect))
2162 for (
int i=0; i<
d->elements.size(); ++i) {
2163 const Element &e =
d->elements.at(i);
2179 if (!
d_ptr || (dx == 0 && dy == 0))
2183 if (elementsLeft <= 0)
2189 while (elementsLeft--) {
2283 for (
int i=0; i<
d->elements.size(); ++i) {
2284 const Element &e =
d->elements.at(i);
2290 for (; !stop && i<
d->elements.size(); ++i) {
2291 const Element &el =
d->elements.at(i);
2338 else if (!d || !path.
d_func())
2342 else if (d->elements.size() != path.
d_func()->elements.size())
2345 const qreal qt_epsilon =
sizeof(
qreal) ==
sizeof(
double) ? 1e-12 :
qreal(1e-5);
2348 epsilon.
rwidth() *= qt_epsilon;
2349 epsilon.
rheight() *= qt_epsilon;
2351 for (
int i = 0; i < d->elements.size(); ++i)
2352 if (d->elements.at(i).type != path.
d_func()->elements.at(i).type
2370 return !(*
this==path);
2446 return *
this = (*
this & other);
2461 return *
this = (*
this | other);
2477 return *
this = (*
this + other);
2493 return *
this = (*
this - other);
2496 #ifndef QT_NO_DATASTREAM 2517 for (
int i=0; i < p.
d_func()->elements.size(); ++i) {
2520 s << double(e.
x) << double(e.
y);
2548 if (p.
d_func()->elements.size() == 1) {
2550 p.
d_func()->elements.clear();
2552 p.
d_func()->elements.reserve(p.
d_func()->elements.size() + size);
2553 for (
int i=0; i<size; ++i) {
2562 qWarning(
"QDataStream::operator>>: NaN or Inf element found in path, skipping it");
2567 p.
d_func()->elements.append(elm);
2578 #endif // QT_NO_DATASTREAM 2744 d_func()->stroker.setCapStyle(style);
2753 return d_func()->stroker.capStyle();
2761 d_func()->stroker.setJoinStyle(style);
2769 return d_func()->stroker.joinStyle();
2847 d_func()->dashPattern.clear();
2848 for (
int i=0; i<dashPattern.
size(); ++i)
2857 return d_func()->dashPattern;
2865 return d_func()->dashOffset;
2876 d_func()->dashOffset = offset;
2902 for (
int i=0; i<flats.
size(); ++i) {
2903 polygon += flats.
at(i);
2905 polygon += flats.
at(i).
first();
2924 return 3*t*t*(d - 3*c + 3*b -
a) + 6*t*(c - 2*b + a) + 3*(b -
a);
2937 for (
int i=1; i<
d->elements.size(); ++i) {
2938 const Element &e =
d->elements.at(i);
2945 len +=
QLineF(
d->elements.at(i-1), e).length();
2948 case CurveToElement:
2952 d->elements.at(i+1),
2953 d->elements.at(i+2));
2979 qreal totalLength = length();
2980 if (len > totalLength)
2984 for (
int i=1; i<
d->elements.size(); ++i) {
2985 const Element &e =
d->elements.at(i);
2992 QLineF line(
d->elements.at(i-1), e);
2995 if (curLen >= len) {
2996 return len/totalLength ;
3001 case CurveToElement:
3005 d->elements.at(i+1),
3006 d->elements.at(i+2));
3008 qreal prevLen = curLen;
3011 if (curLen >= len) {
3013 return (res * blen + prevLen)/totalLength;
3029 *startingLength = 0;
3037 for (
int i=0; i <= lastElement; ++i) {
3048 if (i == lastElement || curLen/totalLength >= t) {
3049 *bezierLength = llen;
3065 if (i + 2 == lastElement || curLen/totalLength >= t) {
3066 *bezierLength = blen;
3076 *startingLength = curLen;
3092 if (t < 0 || t > 1) {
3093 qWarning(
"QPainterPath::pointAtPercent accepts only values between 0 and 1");
3100 if (
d_ptr->elements.size() == 1)
3101 return d_ptr->elements.at(0);
3103 qreal totalLength = length();
3105 qreal bezierLen = 0;
3107 qreal realT = (totalLength * t - curLen) / bezierLen;
3126 if (t < 0 || t > 1) {
3127 qWarning(
"QPainterPath::angleAtPercent accepts only values between 0 and 1");
3131 qreal totalLength = length();
3133 qreal bezierLen = 0;
3135 qreal realT = (totalLength * t - curLen) / bezierLen;
3143 #if defined(Q_WS_WINCE) 3144 #pragma warning( disable : 4056 4756 ) 3158 if (t < 0 || t > 1) {
3159 qWarning(
"QPainterPath::slopeAtPercent accepts only values between 0 and 1");
3163 qreal totalLength = length();
3165 qreal bezierLen = 0;
3167 qreal realT = (totalLength * t - curLen) / bezierLen;
3174 #define SIGN(x) ((x < 0)?-1:1) 3180 slope = INFINITY*
SIGN(m2);
3182 if (
sizeof(
qreal) ==
sizeof(
double)) {
3183 return 1.79769313486231570e+308;
3185 return ((
qreal)3.40282346638528860e+38);
3224 xRadius = 100 *
qMin(xRadius, w) / w;
3229 yRadius = 100 *
qMin(yRadius, h) / h;
3239 if (xRadius <= 0 || yRadius <= 0) {
3248 qreal rxx2 = w*xRadius/100;
3249 qreal ryy2 = h*yRadius/100;
3254 bool first = d_func()->elements.size() < 2;
3256 arcMoveTo(x, y, rxx2, ryy2, 180);
3257 arcTo(x, y, rxx2, ryy2, 180, -90);
3258 arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90);
3259 arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90);
3260 arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90);
3263 d_func()->require_moveTo =
true;
3264 d_func()->convex = first;
3297 if(xRnd <= 0 || yRnd <= 0) {
3311 qreal rxx2 = w*xRnd/100;
3312 qreal ryy2 = h*yRnd/100;
3317 bool first = d_func()->elements.size() < 2;
3319 arcMoveTo(x, y, rxx2, ryy2, 180);
3320 arcTo(x, y, rxx2, ryy2, 180, -90);
3321 arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90);
3322 arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90);
3323 arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90);
3326 d_func()->require_moveTo =
true;
3327 d_func()->convex = first;
3541 d_func()->dirtyBounds = dirty;
3542 d_func()->dirtyControlBounds = dirty;
3543 delete d_func()->pathConverter;
3544 d_func()->pathConverter = 0;
3545 d_func()->convex =
false;
3557 qreal minx, maxx, miny, maxy;
3558 minx = maxx = d->elements.at(0).x;
3559 miny = maxy = d->elements.at(0).y;
3560 for (
int i=1; i<d->elements.size(); ++i) {
3561 const Element &e = d->elements.at(i);
3566 if (e.
x > maxx) maxx = e.
x;
3567 else if (e.
x < minx) minx = e.
x;
3568 if (e.
y > maxy) maxy = e.
y;
3569 else if (e.
y < miny) miny = e.
y;
3571 case CurveToElement:
3575 d->elements.at(i+1),
3576 d->elements.at(i+2));
3579 qreal bottom = r.bottom();
3580 if (r.x() < minx) minx = r.x();
3581 if (right > maxx) maxx =
right;
3582 if (r.y() < miny) miny = r.y();
3583 if (bottom > maxy) maxy = bottom;
3591 d->
bounds =
QRectF(minx, miny, maxx - minx, maxy - miny);
3604 qreal minx, maxx, miny, maxy;
3605 minx = maxx = d->elements.at(0).x;
3606 miny = maxy = d->elements.at(0).y;
3607 for (
int i=1; i<d->elements.size(); ++i) {
3608 const Element &e = d->elements.at(i);
3609 if (e.
x > maxx) maxx = e.
x;
3610 else if (e.
x < minx) minx = e.
x;
3611 if (e.
y > maxy) maxy = e.
y;
3612 else if (e.
y < miny) miny = e.
y;
3617 #ifndef QT_NO_DEBUG_STREAM 3621 const char *
types[] = {
"MoveTo",
"LineTo",
"CurveTo",
"CurveToData"};
ElementType type
the type of element
The QDebug class provides an output stream for debugging information.
virtual QFixed lineThickness() const
void setDashOffset(qreal offset)
Sets the dash offset for the generated outlines to offset.
QPointF bottomRight() const
Returns the position of the rectangle's bottom-right corner.
The QPainterPath::Element class specifies the position and type of a subpath.
QTextEngine * engine() const
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
void setClipRect(const QRectF &clip)
void addRoundRect(const QRectF &rect, int xRnd, int yRnd)
Adds a rectangle r with rounded corners to the path.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
#define qt_real_to_fixed(real)
void addPath(const QPainterPath &path)
Adds the given path to this path as a closed subpath.
static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth=0)
static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y2, const QRectF &rect)
qreal miterLimit() const
Returns the miter limit for the generated outlines.
#define QT_BEZIER_B(bezier, coord)
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void addRegion(const QRegion ®ion)
Adds the given region to the path by adding each rectangle in the region as a separate closed subpath...
static QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *startingLength, qreal *bezierLength)
static void qt_painterpath_isect_curve(const QBezier &bezier, const QPointF &pt, int *winding, int depth=0)
void translate(qreal dx, qreal dy)
Translates all elements in the path by ({dx}, {dy}).
qreal length() const
Returns the length of the line.
QPainterPath & operator|=(const QPainterPath &other)
Unites this path with other and returns a reference to this path.
static qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)
The QMatrix class specifies 2D transformations of a coordinate system.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
void setDashOffset(qreal offset)
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
qreal width() const
Returns the width.
void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
Adds the given rectangle rect with rounded corners to the path.
T & first()
Returns a reference to the first item in the vector.
qreal width() const
Returns the width of the generated outlines.
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
The QPointF class defines a point in the plane using floating point precision.
qreal height() const
Returns the height.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
The QTextLine class represents a line of text inside a QTextLayout.
QPainterPath subtracted(const QPainterPath &r) const
Returns a path which is p's fill area subtracted from this path's fill area.
QPainterPath operator|(const QPainterPath &other) const
Returns the union of this path and the other path.
QPainterPath intersected(const QPainterPath &r) const
Returns a path which is the intersection of this path's fill area and p's fill area.
QPointF topLeft() const
Returns the position of the rectangle's top-left corner.
static void coefficients(qreal t, qreal &a, qreal &b, qreal &c, qreal &d)
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
qreal dashOffset() const
Returns the dash offset for the generated outlines.
long ASN1_INTEGER_get ASN1_INTEGER * a
QPointF pointAt(qreal t) const
bool intersects(const QRectF &rect) const
Returns true if any point in the given rectangle intersects the path; otherwise returns false...
QPointF bottomLeft() const
Returns the position of the rectangle's bottom-left corner.
bool ref()
Atomically increments the value of this QAtomicInt.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
bool intersects(const QRectF &r) const
Returns true if this rectangle intersects with the given rectangle (i.
qreal y
the y coordinate of the element's position.
The QString class provides a Unicode character string.
bool contains(const QPointF &pt) const
Returns true if the given point is inside the path, otherwise returns false.
void qt_path_stroke_line_to(qfixed x, qfixed y, void *data)
void setDashPattern(const QVector< qfixed > &dashPattern)
void computeBoundingRect() const
Q_DECL_CONSTEXPR T qAbs(const T &t)
QRectF boundingRect() const
Returns the bounding rectangle of the polygon, or QRectF(0,0,0,0) if the polygon is empty...
static void qt_painterpath_isect_line(const QPointF &p1, const QPointF &p2, const QPointF &pos, int *winding)
qreal length(qreal error=0.01) const
qreal slopeAtPercent(qreal t) const
Returns the slope of the path at the percentage t.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
void arcMoveTo(const QRectF &rect, qreal angle)
Creates a move to that lies on the arc that occupies the given rectangle at angle.
void setMiterLimit(qreal length)
Sets the miter limit of the generated outlines to limit.
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
const QPainterPath::Element & elementAt(int i) const
Returns the element at the given index in the painter path.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void qt_path_stroke_move_to(qfixed x, qfixed y, void *data)
QList< QPolygonF > toFillPolygons(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define QT_BEZIER_CHECK_T(bezier, t)
void setCubicToHook(qStrokerCubicToHook cubicToHook)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
qreal x() const
Returns the x-coordinate of this point.
void resize(int size)
Sets the size of the vector to size.
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision...
The QLineF class provides a two-dimensional vector using floating point precision.
QPainterPathStroker()
Creates a new stroker.
void setDashPattern(Qt::PenStyle)
Sets the dash pattern for the generated outlines to style.
QPainterPath & operator+=(const QPainterPath &other)
Unites this path with other, and returns a reference to this path.
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
Q_CORE_EXPORT void qDebug(const char *,...)
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
bool contains(const QPointF &p) const
Returns true if the given point is inside or on the edge of the rectangle; otherwise returns false...
QVector< qfixed > dashPattern
static QRectF qt_painterpath_bezier_extrema(const QBezier &b)
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
#define QT_BEZIER_A(bezier, coord)
qreal qt_t_for_arc_angle(qreal angle)
QTextStream & right(QTextStream &stream)
Calls QTextStream::setFieldAlignment(QTextStream::AlignRight) on stream and returns stream...
#define QT_BEGIN_NAMESPACE
This macro expands to.
qreal & rx()
Returns a reference to the x coordinate of this point.
QPainterPathStrokerPrivate()
The QRectF class defines a rectangle in the plane using floating point precision. ...
void strokePath(const QPainterPath &path, void *data, const QTransform &matrix)
Convenience function that decomposes path into begin(), moveTo(), lineTo(), curevTo() and end() calls...
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path...
static bool isEmpty(const char *str)
bool operator!=(const QPainterPath &other) const
Returns true if this painter path differs from the given path.
QPainterPath()
Constructs an empty QPainterPath object.
QPainterPathData * d_func() const
QPolygonF toFillPolygon(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend class QPainterPathData
~QPainterPath()
Destroys this QPainterPath object.
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
void setCurveThreshold(qreal threshold)
Specifies the curve flattening threshold, controlling the granularity with which the generated outlin...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
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...
qreal height() const
Returns the height of the rectangle.
friend Q_GUI_EXPORT QDataStream & operator>>(QDataStream &, QPainterPath &)
Reads a painter path from the given stream into the specified path, and returns a reference to the st...
QGlyphLayout shapedGlyphs(const QScriptItem *si) const
const T & at(int i) const
Returns the item at index position i in the list.
bool deref()
Atomically decrements the value of this QAtomicInt.
virtual QFixed ascent() const =0
The QPolygonF class provides a vector of points using floating point precision.
static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder)
QPainterPath operator &(const QPainterPath &other) const
qreal percentAtLength(qreal t) const
Returns percentage of the whole path at the specified length len.
QPainterPath & operator=(const QPainterPath &other)
Assigns the given path to this painter path.
Q_CORE_EXPORT void qWarning(const char *,...)
qreal angle() const
Returns the angle of the line in degrees.
static void cleanup(QPainterPathPrivate *d)
qreal angleAtPercent(qreal t) const
Returns the angle of the path tangent at the percentage t.
static const char * data(const QByteArray &arr)
QPointF pointAtPercent(qreal t) const
Returns the point at at the percentage t of the current path.
QScopedPointer< QPainterPathStrokerPrivate > d_ptr
static bool epsilonCompare(const QPointF &a, const QPointF &b, const QSizeF &epsilon)
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
The QRegion class specifies a clip region for a painter.
The QPainterPathStroker class is used to generate fillable outlines for a given painter path...
qreal tAtLength(qreal len) const
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
QPainterPath simplified() const
Returns a simplified version of this path.
void reset(T *other=0)
Deletes the existing object it is pointing to if any, and sets its pointer to other.
const T & at(int i) const
Returns the item at index position i in the vector.
QFontEngine * engineForScript(int script) const
#define qt_fixed_to_real(fixed)
T & first()
Returns a reference to the first item in the list.
static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF &rect)
friend Q_GUI_EXPORT QDataStream & operator<<(QDataStream &, const QPainterPath &)
Writes the given painter path to the given stream, and returns a reference to the stream...
~QPainterPathStroker()
Destroys the stroker.
QPainterPath operator-(const QPainterPath &other) const
Subtracts the other path from a copy of this path, and returns the copy.
qreal angle(const QPointF &p1, const QPointF &p2)
The QTextLayout class is used to lay out and render text.
QVector< qreal > dashPattern() const
Returns the dash pattern for the generated outlines.
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
The QFont class specifies a font used for drawing text.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
QPainterPath united(const QPainterPath &r) const
Returns a path which is the union of this path's fill area and p's fill area.
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength)
Creates an arc that occupies the given rectangle, beginning at the specified startAngle and extending...
void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey, void *data)
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 setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
QExplicitlySharedDataPointer< QFontPrivate > d
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Q_DECL_CONSTEXPR const T & qBound(const T &min, const T &val, const T &max)
qreal length() const
Returns the length of the current path.
int size() const
Returns the number of items in the list.
Qt::PenJoinStyle joinStyle() const
Returns the join style of the generated outlines.
QVector< QPainterPath::Element > elements
The QRect class defines a rectangle in the plane using integer precision.
QDataStream & operator<<(QDataStream &s, const QPainterPath &p)
QPainterPath toReversed() const
Creates and returns a reversed copy of the path.
void split(QBezier *firstHalf, QBezier *secondHalf) const
QSizeF size() const
Returns the size of the rectangle.
qreal & ry()
Returns a reference to the y coordinate of this point.
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...
qreal x
the x coordinate of the element's position.
qreal y() const
Returns the y-coordinate of this point.
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...
static const QTextHtmlElement elements[Html_NumElements]
QPainterPath & operator &=(const QPainterPath &other)
QList< QPolygonF > toSubpathPolygons(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
void setLineToHook(qStrokerLineToHook lineToHook)
QPainterPath operator+(const QPainterPath &other) const
Returns the union of this path and the other path.
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
int elementCount() const
Returns the number of path elements in the painter path.
The QDataStream class provides serialization of binary data to a QIODevice.
void setCacheEnabled(bool enable)
Enables caching of the complete layout information if enable is true; otherwise disables layout cachi...
void reserve(int size)
Attempts to allocate memory for at least size elements.
bool isClosed() const
Returns true if the polygon is closed; otherwise returns false.
void endLayout()
Ends the layout process.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
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.
void setMoveToHook(qStrokerMoveToHook moveToHook)
Qt::PenCapStyle capStyle() const
Returns the cap style of the generated outlines.
QPointF topRight() const
Returns the position of the rectangle's top-right corner.
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
qreal & rheight()
Returns a reference to the height.
QPointF currentPosition() const
Returns the current position of the path.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QPointF center() const
Returns the center point of the rectangle.
QPainterPath subtractedInverted(const QPainterPath &r) const
Use subtracted() instead.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
bool operator==(const QPainterPath &other) const
Returns true if this painterpath is equal to the given path.
qreal & rwidth()
Returns a reference to the width.
QPainterPath & operator-=(const QPainterPath &other)
Subtracts other from this path, and returns a reference to this path.
virtual QFixed underlinePosition() const
static bool qt_is_finite(double d)
static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth=0)
void beginLayout()
Begins the layout process.
QPainterPath clip(Operation op=BoolAnd)
QPainterPath qt_stroke_dash(const QPainterPath &path, qreal *dashes, int dashCount)
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
#define QT_BEZIER_C(bezier, coord)
QScopedPointer< QPainterPathPrivate, QPainterPathPrivateDeleter > d_ptr
void qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length, QPointF *startPoint, QPointF *endPoint)
The QList class is a template class that provides lists.
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
void computeControlPointRect() const
static QVector< qfixed > patternForStyle(Qt::PenStyle style)
QPainterPath translated(qreal dx, qreal dy) const
Returns a copy of the path that is translated by ({dx}, {dy}).
qreal curveThreshold() const
Returns the curve flattening threshold for the generated outlines.
Q_CORE_EXPORT QTextStream & endl(QTextStream &s)