52 #include <private/qbezier_p.h> 56 #define Q_NEAR_CLIP (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001) 61 #define MAP(x, y, nx, ny) \ 71 nx = FX_ + affine._dx; \ 72 ny = FY_ + affine._dy; \ 75 nx = affine._m11 * FX_ + affine._dx; \ 76 ny = affine._m22 * FY_ + affine._dy; \ 81 nx = affine._m11 * FX_ + affine._m21 * FY_ + affine._dx; \ 82 ny = affine._m12 * FX_ + affine._m22 * FY_ + affine._dy; \ 83 if (t == TxProject) { \ 84 qreal w = (m_13 * FX_ + m_23 * FY_ + m_33); \ 85 if (w < qreal(Q_NEAR_CLIP)) w = qreal(Q_NEAR_CLIP); \ 254 , m_13(0), m_23(0), m_33(1)
274 :
affine(h11, h12, h21, h22, h31, h32, true)
293 :
affine(h11, h12, h21, h22, dx, dy, true)
311 :
affine(mtx._m11, mtx._m12, mtx._m21, mtx._m22, mtx._dx, mtx._dy, true),
338 h31, h32, h33,
true);
419 if (dx == 0 && dy == 0)
423 qWarning() <<
"QTransform::translate with NaN called";
466 qWarning() <<
"QTransform::fromTranslate with NaN called";
470 QTransform transform(1, 0, 0, 0, 1, 0, dx, dy, 1,
true);
471 if (dx == 0 && dy == 0)
487 if (sx == 1 && sy == 1)
491 qWarning() <<
"QTransform::scale with NaN called";
532 qWarning() <<
"QTransform::fromScale with NaN called";
536 QTransform transform(sx, 0, 0, 0, sy, 0, 0, 0, 1,
true);
537 if (sx == 1. && sy == 1.)
553 if (sh == 0 && sv == 0)
557 qWarning() <<
"QTransform::shear with NaN called";
621 qWarning() <<
"QTransform::rotate with NaN called";
628 if (a == 90. || a == -270.)
630 else if (a == 270. || a == -90.)
688 *
this = result * *
this;
715 qWarning() <<
"QTransform::rotateRadians with NaN called";
770 *
this = result * *
this;
1050 #ifndef QT_NO_DATASTREAM 1066 s << double(m.
m11())
1112 #endif // QT_NO_DATASTREAM 1114 #ifndef QT_NO_DEBUG_STREAM 1117 static const char *typeStr[] =
1126 0, 0, 0, 0, 0, 0, 0,
1130 dbg.
nospace() <<
"QTransform(type=" << typeStr[m.
type()] <<
',' 1131 <<
" 11=" << m.
m11()
1132 <<
" 12=" << m.
m12()
1133 <<
" 13=" << m.
m13()
1134 <<
" 21=" << m.
m21()
1135 <<
" 22=" << m.
m22()
1136 <<
" 23=" << m.
m23()
1137 <<
" 31=" << m.
m31()
1138 <<
" 32=" << m.
m32()
1139 <<
" 33=" << m.
m33()
1290 qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0;
1352 qreal x1 = 0, y1 = 0, x2 = 0, y2 = 0;
1390 return QLineF(x1, y1, x2, y2);
1395 if (poly.
size() == 0)
1398 if (poly.
size() == 1)
1404 path = transform.
map(path);
1452 int size = a.
size();
1458 for(i = 0; i < size; ++i) {
1459 MAP(da[i].xp, da[i].yp, dp[i].xp, dp[i].yp);
1485 int size = a.
size();
1491 for(i = 0; i < size; ++i) {
1492 qreal nx = 0, ny = 0;
1493 MAP(da[i].xp, da[i].yp, nx, ny);
1554 return QPointF(x * iw, y * iw);
1561 c.
x = transform.
m11() * p.
x() + transform.
m21() * p.
y() + transform.
m31();
1562 c.
y = transform.
m12() * p.
x() + transform.
m22() * p.
y() + transform.
m32();
1563 c.
w = transform.
m13() * p.
x() + transform.
m23() * p.
y() + transform.
m33();
1568 bool needsMoveTo,
bool needsLineTo =
true)
1579 hb.
x += (ha.
x - hb.
x) * t;
1580 hb.
y += (ha.
y - hb.
y) * t;
1585 ha.
x += (hb.
x - ha.
x) * t;
1586 ha.
y += (hb.
y - ha.
y) * t;
1592 needsMoveTo =
false;
1620 for (
int i = 0; i < segment.
size() - 1; ++i)
1622 needsMoveTo =
false;
1624 return !needsMoveTo;
1633 bool needsMoveTo =
true;
1637 if (i > 0 && lastMoveTo != last)
1638 lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo);
1646 needsMoveTo =
false;
1651 needsMoveTo =
false;
1661 lineTo_clipped(result, transform, last, lastMoveTo, needsMoveTo,
false);
1740 qreal x[4] = { 0, 0, 0, 0 }, y[4] = { 0, 0, 0, 0 };
1763 MAP(rect.
x(), rect.
y(), x[0], y[0]);
1764 MAP(right, rect.
y(), x[1], y[1]);
1765 MAP(right, bottom, x[2], y[2]);
1766 MAP(rect.
x(), bottom, x[3], y[3]);
1787 if (quad.
count() != 4)
1790 qreal dx0 = quad[0].x();
1791 qreal dx1 = quad[1].x();
1792 qreal dx2 = quad[2].x();
1793 qreal dx3 = quad[3].x();
1795 qreal dy0 = quad[0].y();
1796 qreal dy1 = quad[1].y();
1797 qreal dy2 = quad[2].y();
1798 qreal dy3 = quad[3].y();
1800 double ax = dx0 - dx1 + dx2 - dx3;
1801 double ay = dy0 - dy1 + dy2 - dy3;
1804 trans.
setMatrix(dx1 - dx0, dy1 - dy0, 0,
1805 dx2 - dx1, dy2 - dy1, 0,
1808 double ax1 = dx1 - dx2;
1809 double ax2 = dx3 - dx2;
1810 double ay1 = dy1 - dy2;
1811 double ay2 = dy3 - dy2;
1814 double gtop = ax * ay2 - ax2 * ay;
1815 double htop = ax1 * ay - ax * ay1;
1816 double bottom = ax1 * ay2 - ax2 * ay1;
1818 double a, b,
c,
d, e, f, g, h;
1826 a = dx1 - dx0 + g * dx1;
1827 b = dx3 - dx0 + h * dx3;
1829 d = dy1 - dy0 + g * dy1;
1830 e = dy3 - dy0 + h * dy3;
1858 bool invertible =
false;
1859 trans = trans.
inverted(&invertible);
1939 return QRect(x, y, w, h);
1949 xmin =
qMin(xmin, x);
1950 ymin =
qMin(ymin, y);
1951 xmax =
qMax(xmax, x);
1952 ymax =
qMax(ymax, y);
1954 xmin =
qMin(xmin, x);
1955 ymin =
qMin(ymin, y);
1956 xmax =
qMax(xmax, x);
1957 ymax =
qMax(ymax, y);
1959 xmin =
qMin(xmin, x);
1960 ymin =
qMin(ymin, y);
1961 xmax =
qMax(xmax, x);
1962 ymax =
qMax(ymax, y);
1967 return map(path).boundingRect().toRect();
2012 return QRectF(x, y, w, h);
2015 MAP(rect.
x(), rect.
y(), x, y);
2020 MAP(rect.
x() + rect.
width(), rect.
y(), x, y);
2021 xmin =
qMin(xmin, x);
2022 ymin =
qMin(ymin, y);
2023 xmax =
qMax(xmax, x);
2024 ymax =
qMax(ymax, y);
2026 xmin =
qMin(xmin, x);
2027 ymin =
qMin(ymin, y);
2028 xmax =
qMax(xmax, x);
2029 ymax =
qMax(ymax, y);
2031 xmin =
qMin(xmin, x);
2032 ymin =
qMin(ymin, y);
2033 xmax =
qMax(xmax, x);
2034 ymax =
qMax(ymax, y);
2035 return QRectF(xmin, ymin, xmax-xmin, ymax - ymin);
2039 return map(path).boundingRect();
2073 MAP(x, y, *tx, *ty);
2087 qreal fx = 0, fy = 0;
2121 switch (static_cast<TransformationType>(
m_dirty)) {
2418 *scale =
qMax(xScale, yScale);
2422 const qreal xScale = transform.
m11() * transform.
m11()
2423 + transform.
m21() * transform.
m21();
2424 const qreal yScale = transform.
m12() * transform.
m12()
2425 + transform.
m22() * transform.
m22();
ElementType type
the type of element
The QVariant class acts like a union for the most common Qt data types.
The QDebug class provides an output stream for debugging information.
The QPainterPath::Element class specifies the position and type of a subpath.
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.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
void translate(qreal dx, qreal dy)
Translates all elements in the path by ({dx}, {dy}).
The QLine class provides a two-dimensional vector using integer precision.
QPolygon translated(int dx, int dy) const
Returns a copy of the polygon that is translated by ({dx}, {dy}).
The QMatrix class specifies 2D transformations of a coordinate system.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
int count(const T &t) const
Returns the number of occurrences of value in the vector.
qreal x2() const
Returns the x-coordinate of the line's end point.
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
qreal y2() const
Returns the y-coordinate of the line's end point.
The QPointF class defines a point in the plane using floating point precision.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
int left() const
Returns the x-coordinate of the rectangle's left edge.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int width() const
Returns the width of the rectangle.
long ASN1_INTEGER_get ASN1_INTEGER * a
QRect boundingRect() const
Returns the bounding rectangle of this region.
The QPolygon class provides a vector of points using integer precision.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
int height() const
Returns the height of the rectangle.
qreal y
the y coordinate of the element's position.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
Q_DECL_CONSTEXPR T qAbs(const T &t)
QPolygon toPolygon() const
Creates and returns a QPolygon by converting each QPointF to a QPoint.
int y1() const
Returns the y-coordinate of the line's start point.
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.
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
qreal x() const
Returns the x-coordinate of this point.
The QLineF class provides a two-dimensional vector using floating point precision.
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
QPolygonF translated(qreal dx, qreal dy) const
Returns a copy of the polygon that is translated by ({dx}, {dy}).
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
const QPointF toPoint() const
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QPolygonF toFillPolygon(const QMatrix &matrix=QMatrix()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
qreal height() const
Returns the height of the rectangle.
qreal y1() const
Returns the y-coordinate of the line's start point.
The QPolygonF class provides a vector of points using floating point precision.
Q_CORE_EXPORT void qWarning(const char *,...)
int x2() const
Returns the x-coordinate of the line's end point.
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.
Qt::FillRule fillRule() const
Returns the painter path's currently set fill rule.
Q_CORE_EXPORT bool qIsNaN(double d)
Returns true if the double {d} is not a number (NaN).
const T & at(int i) const
Returns the item at index position i in the vector.
int top() const
Returns the y-coordinate of the rectangle's top edge.
QPolygonF toPolygon(qreal bezier_flattening_threshold=0.5) const
int right() const
Returns the x-coordinate of the rectangle's right edge.
int y() const
Returns the y-coordinate of the rectangle's top edge.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
QVector< QPainterPath::Element > elements
The QRect class defines a rectangle in the plane using integer precision.
#define Q_AUTOTEST_EXPORT
qreal x
the x coordinate of the element's position.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
T * data()
Returns a pointer to the data stored in the vector.
void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
int elementCount() const
Returns the number of path elements in the painter path.
The QDataStream class provides serialization of binary data to a QIODevice.
const T * constData() const
Returns a const pointer to the data stored in the vector.
int y2() const
Returns the y-coordinate of the line's end point.
int x() const
Returns the x coordinate of this point.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QHomogeneousCoordinate(qreal x_, qreal y_, qreal w_)
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
qreal x1() const
Returns the x-coordinate of the line's start point.
int x1() const
Returns the x-coordinate of the line's start point.
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
static qreal dot(const QPointF &a, const QPointF &b)
int size() const
Returns the number of items in the vector.
Q_DECL_CONSTEXPR int qRound(qreal d)
QMatrix inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
QScopedPointer< QPainterPathPrivate, QPainterPathPrivateDeleter > d_ptr