51 #include <private/qbezier_p.h>
57 static void nanWarning(
const char *
func)
63 #define Q_NEAR_CLIP (sizeof(qreal) == sizeof(double) ? 0.000001 : 0.0001)
68 #define MAP(x, y, nx, ny) \
78 nx = FX_ + m_matrix[2][0]; \
79 ny = FY_ + m_matrix[2][1]; \
82 nx = m_matrix[0][0] * FX_ + m_matrix[2][0]; \
83 ny = m_matrix[1][1] * FY_ + m_matrix[2][1]; \
88 nx = m_matrix[0][0] * FX_ + m_matrix[1][0] * FY_ + m_matrix[2][0]; \
89 ny = m_matrix[0][1] * FX_ + m_matrix[1][1] * FY_ + m_matrix[2][1]; \
90 if (t == TxProject) { \
91 qreal w = (m_matrix[0][2] * FX_ + m_matrix[1][2] * FY_ + m_matrix[2][2]); \
92 if (w < qreal(Q_NEAR_CLIP)) w = qreal(Q_NEAR_CLIP); \
303 h11 = m_matrix[1][1] * m_matrix[2][2] - m_matrix[1][2] * m_matrix[2][1];
304 h21 = m_matrix[1][2] * m_matrix[2][0] - m_matrix[1][0] * m_matrix[2][2];
305 h31 = m_matrix[1][0] * m_matrix[2][1] - m_matrix[1][1] * m_matrix[2][0];
306 h12 = m_matrix[0][2] * m_matrix[2][1] - m_matrix[0][1] * m_matrix[2][2];
307 h22 = m_matrix[0][0] * m_matrix[2][2] - m_matrix[0][2] * m_matrix[2][0];
308 h32 = m_matrix[0][1] * m_matrix[2][0] - m_matrix[0][0] * m_matrix[2][1];
309 h13 = m_matrix[0][1] * m_matrix[1][2] - m_matrix[0][2] * m_matrix[1][1];
310 h23 = m_matrix[0][2] * m_matrix[1][0] - m_matrix[0][0] * m_matrix[1][2];
311 h33 = m_matrix[0][0] * m_matrix[1][1] - m_matrix[0][1] * m_matrix[1][0];
323 QTransform t(m_matrix[0][0], m_matrix[1][0], m_matrix[2][0],
324 m_matrix[0][1], m_matrix[1][1], m_matrix[2][1],
325 m_matrix[0][2], m_matrix[1][2], m_matrix[2][2]);
344 switch(inline_type()) {
348 invert.m_matrix[2][0] = -m_matrix[2][0];
349 invert.m_matrix[2][1] = -m_matrix[2][1];
355 invert.m_matrix[0][0] = 1. / m_matrix[0][0];
356 invert.m_matrix[1][1] = 1. / m_matrix[1][1];
357 invert.m_matrix[2][0] = -m_matrix[2][0] *
invert.m_matrix[0][0];
358 invert.m_matrix[2][1] = -m_matrix[2][1] *
invert.m_matrix[1][1];
394 if (
dx == 0 &&
dy == 0)
398 nanWarning(
"translate");
403 switch(inline_type()) {
409 m_matrix[2][0] +=
dx;
410 m_matrix[2][1] +=
dy;
413 m_matrix[2][0] +=
dx * m_matrix[0][0];
414 m_matrix[2][1] +=
dy * m_matrix[1][1];
417 m_matrix[2][2] +=
dx * m_matrix[0][2] +
dy * m_matrix[1][2];
421 m_matrix[2][0] +=
dx * m_matrix[0][0] +
dy * m_matrix[1][0];
422 m_matrix[2][1] +=
dy * m_matrix[1][1] +
dx * m_matrix[0][1];
441 nanWarning(
"fromTranslate");
446 if (
dx == 0 &&
dy == 0)
462 if (sx == 1 && sy == 1)
471 switch(inline_type()) {
478 m_matrix[0][2] *= sx;
479 m_matrix[1][2] *= sy;
483 m_matrix[0][1] *= sx;
484 m_matrix[1][0] *= sy;
487 m_matrix[0][0] *= sx;
488 m_matrix[1][1] *= sy;
507 nanWarning(
"fromScale");
512 if (sx == 1. && sy == 1.)
528 if (sh == 0 && sv == 0)
537 switch(inline_type()) {
544 m_matrix[0][1] = sv*m_matrix[1][1];
545 m_matrix[1][0] = sh*m_matrix[0][0];
548 qreal tm13 = sv * m_matrix[1][2];
549 qreal tm23 = sh * m_matrix[0][2];
550 m_matrix[0][2] += tm13;
551 m_matrix[1][2] += tm23;
556 qreal tm11 = sv * m_matrix[1][0];
557 qreal tm22 = sh * m_matrix[0][1];
558 qreal tm12 = sv * m_matrix[1][1];
559 qreal tm21 = sh * m_matrix[0][0];
560 m_matrix[0][0] += tm11;
561 m_matrix[0][1] += tm12;
562 m_matrix[1][0] += tm21;
563 m_matrix[1][1] += tm22;
594 nanWarning(
"rotate");
601 if (
a == 90. ||
a == -270.)
603 else if (
a == 270. ||
a == -90.)
614 switch(inline_type()) {
617 m_matrix[0][0] = cosa;
618 m_matrix[0][1] = sina;
619 m_matrix[1][0] = -sina;
620 m_matrix[1][1] = cosa;
623 qreal tm11 = cosa * m_matrix[0][0];
624 qreal tm12 = sina * m_matrix[1][1];
625 qreal tm21 = -sina * m_matrix[0][0];
626 qreal tm22 = cosa * m_matrix[1][1];
627 m_matrix[0][0] = tm11;
628 m_matrix[0][1] = tm12;
629 m_matrix[1][0] = tm21;
630 m_matrix[1][1] = tm22;
634 qreal tm13 = cosa * m_matrix[0][2] + sina * m_matrix[1][2];
635 qreal tm23 = -sina * m_matrix[0][2] + cosa * m_matrix[1][2];
636 m_matrix[0][2] = tm13;
637 m_matrix[1][2] = tm23;
642 qreal tm11 = cosa * m_matrix[0][0] + sina * m_matrix[1][0];
643 qreal tm12 = cosa * m_matrix[0][1] + sina * m_matrix[1][1];
644 qreal tm21 = -sina * m_matrix[0][0] + cosa * m_matrix[1][0];
645 qreal tm22 = -sina * m_matrix[0][1] + cosa * m_matrix[1][1];
646 m_matrix[0][0] = tm11;
647 m_matrix[0][1] = tm12;
648 m_matrix[1][0] = tm21;
649 m_matrix[1][1] = tm22;
658 result.m_matrix[0][0] = cosa;
661 result.m_matrix[1][1] = cosa;
689 nanWarning(
"rotateRadians");
697 switch(inline_type()) {
700 m_matrix[0][0] = cosa;
701 m_matrix[0][1] = sina;
702 m_matrix[1][0] = -sina;
703 m_matrix[1][1] = cosa;
706 qreal tm11 = cosa * m_matrix[0][0];
707 qreal tm12 = sina * m_matrix[1][1];
708 qreal tm21 = -sina * m_matrix[0][0];
709 qreal tm22 = cosa * m_matrix[1][1];
710 m_matrix[0][0] = tm11;
711 m_matrix[0][1] = tm12;
712 m_matrix[1][0] = tm21;
713 m_matrix[1][1] = tm22;
717 qreal tm13 = cosa * m_matrix[0][2] + sina * m_matrix[1][2];
718 qreal tm23 = -sina * m_matrix[0][2] + cosa * m_matrix[1][2];
719 m_matrix[0][2] = tm13;
720 m_matrix[1][2] = tm23;
725 qreal tm11 = cosa * m_matrix[0][0] + sina * m_matrix[1][0];
726 qreal tm12 = cosa * m_matrix[0][1] + sina * m_matrix[1][1];
727 qreal tm21 = -sina * m_matrix[0][0] + cosa * m_matrix[1][0];
728 qreal tm22 = -sina * m_matrix[0][1] + cosa * m_matrix[1][1];
729 m_matrix[0][0] = tm11;
730 m_matrix[0][1] = tm12;
731 m_matrix[1][0] = tm21;
732 m_matrix[1][1] = tm22;
741 result.m_matrix[0][0] = cosa;
744 result.m_matrix[1][1] = cosa;
760 return m_matrix[0][0] ==
o.m_matrix[0][0] &&
761 m_matrix[0][1] ==
o.m_matrix[0][1] &&
762 m_matrix[1][0] ==
o.m_matrix[1][0] &&
763 m_matrix[1][1] ==
o.m_matrix[1][1] &&
764 m_matrix[2][0] ==
o.m_matrix[2][0] &&
765 m_matrix[2][1] ==
o.m_matrix[2][1] &&
766 m_matrix[0][2] ==
o.m_matrix[0][2] &&
767 m_matrix[1][2] ==
o.m_matrix[1][2] &&
768 m_matrix[2][2] ==
o.m_matrix[2][2];
826 m_matrix[2][0] +=
o.m_matrix[2][0];
827 m_matrix[2][1] +=
o.m_matrix[2][1];
831 qreal m11 = m_matrix[0][0] *
o.m_matrix[0][0];
832 qreal m22 = m_matrix[1][1] *
o.m_matrix[1][1];
834 qreal m31 = m_matrix[2][0] *
o.m_matrix[0][0] +
o.m_matrix[2][0];
835 qreal m32 = m_matrix[2][1] *
o.m_matrix[1][1] +
o.m_matrix[2][1];
837 m_matrix[0][0] =
m11;
838 m_matrix[1][1] =
m22;
839 m_matrix[2][0] =
m31; m_matrix[2][1] =
m32;
845 qreal m11 = m_matrix[0][0] *
o.m_matrix[0][0] + m_matrix[0][1] *
o.m_matrix[1][0];
846 qreal m12 = m_matrix[0][0] *
o.m_matrix[0][1] + m_matrix[0][1] *
o.m_matrix[1][1];
848 qreal m21 = m_matrix[1][0] *
o.m_matrix[0][0] + m_matrix[1][1] *
o.m_matrix[1][0];
849 qreal m22 = m_matrix[1][0] *
o.m_matrix[0][1] + m_matrix[1][1] *
o.m_matrix[1][1];
851 qreal m31 = m_matrix[2][0] *
o.m_matrix[0][0] + m_matrix[2][1] *
o.m_matrix[1][0] +
o.m_matrix[2][0];
852 qreal m32 = m_matrix[2][0] *
o.m_matrix[0][1] + m_matrix[2][1] *
o.m_matrix[1][1] +
o.m_matrix[2][1];
854 m_matrix[0][0] =
m11;
855 m_matrix[0][1] =
m12;
856 m_matrix[1][0] =
m21;
857 m_matrix[1][1] =
m22;
858 m_matrix[2][0] =
m31;
859 m_matrix[2][1] =
m32;
864 qreal m11 = m_matrix[0][0] *
o.m_matrix[0][0] + m_matrix[0][1] *
o.m_matrix[1][0] + m_matrix[0][2] *
o.m_matrix[2][0];
865 qreal m12 = m_matrix[0][0] *
o.m_matrix[0][1] + m_matrix[0][1] *
o.m_matrix[1][1] + m_matrix[0][2] *
o.m_matrix[2][1];
866 qreal m13 = m_matrix[0][0] *
o.m_matrix[0][2] + m_matrix[0][1] *
o.m_matrix[1][2] + m_matrix[0][2] *
o.m_matrix[2][2];
868 qreal m21 = m_matrix[1][0] *
o.m_matrix[0][0] + m_matrix[1][1] *
o.m_matrix[1][0] + m_matrix[1][2] *
o.m_matrix[2][0];
869 qreal m22 = m_matrix[1][0] *
o.m_matrix[0][1] + m_matrix[1][1] *
o.m_matrix[1][1] + m_matrix[1][2] *
o.m_matrix[2][1];
870 qreal m23 = m_matrix[1][0] *
o.m_matrix[0][2] + m_matrix[1][1] *
o.m_matrix[1][2] + m_matrix[1][2] *
o.m_matrix[2][2];
872 qreal m31 = m_matrix[2][0] *
o.m_matrix[0][0] + m_matrix[2][1] *
o.m_matrix[1][0] + m_matrix[2][2] *
o.m_matrix[2][0];
873 qreal m32 = m_matrix[2][0] *
o.m_matrix[0][1] + m_matrix[2][1] *
o.m_matrix[1][1] + m_matrix[2][2] *
o.m_matrix[2][1];
874 qreal m33 = m_matrix[2][0] *
o.m_matrix[0][2] + m_matrix[2][1] *
o.m_matrix[1][2] + m_matrix[2][2] *
o.m_matrix[2][2];
876 m_matrix[0][0] =
m11; m_matrix[0][1] =
m12; m_matrix[0][2] =
m13;
877 m_matrix[1][0] =
m21; m_matrix[1][1] =
m22; m_matrix[1][2] =
m23;
878 m_matrix[2][0] =
m31; m_matrix[2][1] =
m32; m_matrix[2][2] =
m33;
912 t.m_matrix[2][0] = m_matrix[2][0] +
m.m_matrix[2][0];
913 t.m_matrix[2][1] = m_matrix[2][1] +
m.m_matrix[2][1];
917 qreal m11 = m_matrix[0][0] *
m.m_matrix[0][0];
918 qreal m22 = m_matrix[1][1] *
m.m_matrix[1][1];
920 qreal m31 = m_matrix[2][0] *
m.m_matrix[0][0] +
m.m_matrix[2][0];
921 qreal m32 = m_matrix[2][1] *
m.m_matrix[1][1] +
m.m_matrix[2][1];
923 t.m_matrix[0][0] =
m11;
924 t.m_matrix[1][1] =
m22;
925 t.m_matrix[2][0] =
m31;
926 t.m_matrix[2][1] =
m32;
932 qreal m11 = m_matrix[0][0] *
m.m_matrix[0][0] + m_matrix[0][1] *
m.m_matrix[1][0];
933 qreal m12 = m_matrix[0][0] *
m.m_matrix[0][1] + m_matrix[0][1] *
m.m_matrix[1][1];
935 qreal m21 = m_matrix[1][0] *
m.m_matrix[0][0] + m_matrix[1][1] *
m.m_matrix[1][0];
936 qreal m22 = m_matrix[1][0] *
m.m_matrix[0][1] + m_matrix[1][1] *
m.m_matrix[1][1];
938 qreal m31 = m_matrix[2][0] *
m.m_matrix[0][0] + m_matrix[2][1] *
m.m_matrix[1][0] +
m.m_matrix[2][0];
939 qreal m32 = m_matrix[2][0] *
m.m_matrix[0][1] + m_matrix[2][1] *
m.m_matrix[1][1] +
m.m_matrix[2][1];
941 t.m_matrix[0][0] =
m11;
t.m_matrix[0][1] =
m12;
942 t.m_matrix[1][0] =
m21;
t.m_matrix[1][1] =
m22;
943 t.m_matrix[2][0] =
m31;
t.m_matrix[2][1] =
m32;
948 qreal m11 = m_matrix[0][0] *
m.m_matrix[0][0] + m_matrix[0][1] *
m.m_matrix[1][0] + m_matrix[0][2] *
m.m_matrix[2][0];
949 qreal m12 = m_matrix[0][0] *
m.m_matrix[0][1] + m_matrix[0][1] *
m.m_matrix[1][1] + m_matrix[0][2] *
m.m_matrix[2][1];
950 qreal m13 = m_matrix[0][0] *
m.m_matrix[0][2] + m_matrix[0][1] *
m.m_matrix[1][2] + m_matrix[0][2] *
m.m_matrix[2][2];
952 qreal m21 = m_matrix[1][0] *
m.m_matrix[0][0] + m_matrix[1][1] *
m.m_matrix[1][0] + m_matrix[1][2] *
m.m_matrix[2][0];
953 qreal m22 = m_matrix[1][0] *
m.m_matrix[0][1] + m_matrix[1][1] *
m.m_matrix[1][1] + m_matrix[1][2] *
m.m_matrix[2][1];
954 qreal m23 = m_matrix[1][0] *
m.m_matrix[0][2] + m_matrix[1][1] *
m.m_matrix[1][2] + m_matrix[1][2] *
m.m_matrix[2][2];
956 qreal m31 = m_matrix[2][0] *
m.m_matrix[0][0] + m_matrix[2][1] *
m.m_matrix[1][0] + m_matrix[2][2] *
m.m_matrix[2][0];
957 qreal m32 = m_matrix[2][0] *
m.m_matrix[0][1] + m_matrix[2][1] *
m.m_matrix[1][1] + m_matrix[2][2] *
m.m_matrix[2][1];
958 qreal m33 = m_matrix[2][0] *
m.m_matrix[0][2] + m_matrix[2][1] *
m.m_matrix[1][2] + m_matrix[2][2] *
m.m_matrix[2][2];
960 t.m_matrix[0][0] =
m11;
t.m_matrix[0][1] =
m12;
t.m_matrix[0][2] =
m13;
961 t.m_matrix[1][0] =
m21;
t.m_matrix[1][1] =
m22;
t.m_matrix[1][2] =
m23;
962 t.m_matrix[2][0] =
m31;
t.m_matrix[2][1] =
m32;
t.m_matrix[2][2] =
m33;
1023 #ifndef QT_NO_DATASTREAM
1036 s << double(
m.m11())
1060 double m11, m12, m13,
1073 t.setMatrix(m11, m12, m13,
1081 #ifndef QT_NO_DEBUG_STREAM
1084 static const char typeStr[][12] =
1093 "",
"",
"",
"",
"",
"",
"",
1098 dbg.
nospace() <<
"QTransform(type=" << typeStr[
m.type()] <<
','
1099 <<
" 11=" <<
m.m11()
1100 <<
" 12=" <<
m.m12()
1101 <<
" 13=" <<
m.m13()
1102 <<
" 21=" <<
m.m21()
1103 <<
" 22=" <<
m.m22()
1104 <<
" 23=" <<
m.m23()
1105 <<
" 31=" <<
m.m31()
1106 <<
" 32=" <<
m.m32()
1107 <<
" 33=" <<
m.m33()
1136 x = fx + m_matrix[2][0];
1137 y = fy + m_matrix[2][1];
1140 x = m_matrix[0][0] * fx + m_matrix[2][0];
1141 y = m_matrix[1][1] * fy + m_matrix[2][1];
1146 x = m_matrix[0][0] * fx + m_matrix[1][0] * fy + m_matrix[2][0];
1147 y = m_matrix[0][1] * fx + m_matrix[1][1] * fy + m_matrix[2][1];
1149 qreal w = 1./(m_matrix[0][2] * fx + m_matrix[1][2] * fy + m_matrix[2][2]);
1187 x = fx + m_matrix[2][0];
1188 y = fy + m_matrix[2][1];
1191 x = m_matrix[0][0] * fx + m_matrix[2][0];
1192 y = m_matrix[1][1] * fy + m_matrix[2][1];
1197 x = m_matrix[0][0] * fx + m_matrix[1][0] * fy + m_matrix[2][0];
1198 y = m_matrix[0][1] * fx + m_matrix[1][1] * fy + m_matrix[2][1];
1200 qreal w = 1./(m_matrix[0][2] * fx + m_matrix[1][2] * fy + m_matrix[2][2]);
1260 x1 = fx1 + m_matrix[2][0];
1261 y1 = fy1 + m_matrix[2][1];
1262 x2 = fx2 + m_matrix[2][0];
1263 y2 = fy2 + m_matrix[2][1];
1266 x1 = m_matrix[0][0] * fx1 + m_matrix[2][0];
1267 y1 = m_matrix[1][1] * fy1 + m_matrix[2][1];
1268 x2 = m_matrix[0][0] * fx2 + m_matrix[2][0];
1269 y2 = m_matrix[1][1] * fy2 + m_matrix[2][1];
1274 x1 = m_matrix[0][0] * fx1 + m_matrix[1][0] * fy1 + m_matrix[2][0];
1275 y1 = m_matrix[0][1] * fx1 + m_matrix[1][1] * fy1 + m_matrix[2][1];
1276 x2 = m_matrix[0][0] * fx2 + m_matrix[1][0] * fy2 + m_matrix[2][0];
1277 y2 = m_matrix[0][1] * fx2 + m_matrix[1][1] * fy2 + m_matrix[2][1];
1279 qreal w = 1./(m_matrix[0][2] * fx1 + m_matrix[1][2] * fy1 + m_matrix[2][2]);
1282 w = 1./(m_matrix[0][2] * fx2 + m_matrix[1][2] * fy2 + m_matrix[2][2]);
1319 x1 = fx1 + m_matrix[2][0];
1320 y1 = fy1 + m_matrix[2][1];
1321 x2 = fx2 + m_matrix[2][0];
1322 y2 = fy2 + m_matrix[2][1];
1325 x1 = m_matrix[0][0] * fx1 + m_matrix[2][0];
1326 y1 = m_matrix[1][1] * fy1 + m_matrix[2][1];
1327 x2 = m_matrix[0][0] * fx2 + m_matrix[2][0];
1328 y2 = m_matrix[1][1] * fy2 + m_matrix[2][1];
1333 x1 = m_matrix[0][0] * fx1 + m_matrix[1][0] * fy1 + m_matrix[2][0];
1334 y1 = m_matrix[0][1] * fx1 + m_matrix[1][1] * fy1 + m_matrix[2][1];
1335 x2 = m_matrix[0][0] * fx2 + m_matrix[1][0] * fy2 + m_matrix[2][0];
1336 y2 = m_matrix[0][1] * fx2 + m_matrix[1][1] * fy2 + m_matrix[2][1];
1338 qreal w = 1./(m_matrix[0][2] * fx1 + m_matrix[1][2] * fy1 + m_matrix[2][2]);
1341 w = 1./(m_matrix[0][2] * fx2 + m_matrix[1][2] * fy2 + m_matrix[2][2]);
1351 if (poly.
size() == 0)
1354 if (poly.
size() == 1)
1358 path.addPolygon(poly);
1363 const int elementCount =
path.elementCount();
1364 result.reserve(elementCount);
1365 for (
int i = 0;
i < elementCount; ++
i)
1402 return a.translated(m_matrix[2][0], m_matrix[2][1]);
1405 return mapProjective(*
this,
a);
1407 int size =
a.size();
1414 MAP(da[
i].xp, da[
i].yp, dp[
i].xp, dp[
i].yp);
1432 return a.translated(
qRound(m_matrix[2][0]),
qRound(m_matrix[2][1]));
1440 const QPoint *da =
a.constData();
1487 if (
m11() < 0 ||
m22() < 0) {
1504 return p.toFillPolygon().toPolygon();
1532 bool needsMoveTo,
bool needsLineTo =
true)
1543 hb.
x += (ha.
x - hb.
x) *
t;
1544 hb.
y += (ha.
y - hb.
y) *
t;
1549 ha.
x += (hb.
x - ha.
x) *
t;
1550 ha.
y += (hb.
y - ha.
y) *
t;
1556 needsMoveTo =
false;
1586 needsMoveTo =
false;
1588 return !needsMoveTo;
1597 bool needsMoveTo =
true;
1598 for (
int i = 0;
i <
path.elementCount(); ++
i) {
1599 switch (
path.elementAt(
i).type) {
1601 if (
i > 0 && lastMoveTo != last)
1604 lastMoveTo =
path.elementAt(
i);
1605 last =
path.elementAt(
i);
1610 needsMoveTo =
false;
1611 last =
path.elementAt(
i);
1615 needsMoveTo =
false;
1617 last =
path.elementAt(
i);
1624 if (
path.elementCount() > 0 && lastMoveTo != last)
1625 lineTo_clipped(
result,
transform, last, lastMoveTo, needsMoveTo,
false);
1655 return mapProjective(*
this,
path);
1660 copy.
translate(m_matrix[2][0], m_matrix[2][1]);
1664 for (
int i=0;
i<
path.elementCount(); ++
i) {
1698 qreal x[4] = { 0, 0, 0, 0 },
y[4] = { 0, 0, 0, 0 };
1700 x[0] = m_matrix[0][0]*
rect.x() + m_matrix[2][0];
1701 y[0] = m_matrix[1][1]*
rect.y() + m_matrix[2][1];
1745 if (quad.
count() != 4)
1748 qreal dx0 = quad[0].x();
1749 qreal dx1 = quad[1].x();
1750 qreal dx2 = quad[2].x();
1751 qreal dx3 = quad[3].x();
1753 qreal dy0 = quad[0].y();
1754 qreal dy1 = quad[1].y();
1755 qreal dy2 = quad[2].y();
1756 qreal dy3 = quad[3].y();
1758 double ax = dx0 - dx1 + dx2 - dx3;
1759 double ay = dy0 - dy1 + dy2 - dy3;
1762 trans.
setMatrix(dx1 - dx0, dy1 - dy0, 0,
1763 dx2 - dx1, dy2 - dy1, 0,
1766 double ax1 = dx1 - dx2;
1767 double ax2 = dx3 - dx2;
1768 double ay1 = dy1 - dy2;
1769 double ay2 = dy3 - dy2;
1772 double gtop = ax * ay2 - ax2 * ay;
1773 double htop = ax1 * ay - ax * ay1;
1774 double bottom = ax1 * ay2 - ax2 * ay1;
1784 a = dx1 - dx0 +
g * dx1;
1785 b = dx3 - dx0 +
h * dx3;
1787 d = dy1 - dy0 +
g * dy1;
1788 e = dy3 - dy0 +
h * dy3;
1813 bool invertible =
false;
1814 trans = trans.
inverted(&invertible);
1860 m_matrix[0][0] =
m11; m_matrix[0][1] =
m12; m_matrix[0][2] =
m13;
1861 m_matrix[1][0] =
m21; m_matrix[1][1] =
m22; m_matrix[1][2] =
m23;
1862 m_matrix[2][0] =
m31; m_matrix[2][1] =
m32; m_matrix[2][2] =
m33;
1882 int x =
qRound(m_matrix[0][0] *
rect.x() + m_matrix[2][0]);
1883 int y =
qRound(m_matrix[1][1] *
rect.y() + m_matrix[2][1]);
1895 }
else if (
t <
TxProject || !needsPerspectiveClipping(
rect, *
this)) {
1904 xmin = qMin(xmin,
x);
1905 ymin = qMin(ymin,
y);
1906 xmax = qMax(xmax,
x);
1907 ymax = qMax(ymax,
y);
1909 xmin = qMin(xmin,
x);
1910 ymin = qMin(ymin,
y);
1911 xmax = qMax(xmax,
x);
1912 ymax = qMax(ymax,
y);
1914 xmin = qMin(xmin,
x);
1915 ymin = qMin(ymin,
y);
1916 xmax = qMax(xmax,
x);
1917 ymax = qMax(ymax,
y);
1922 return map(
path).boundingRect().toRect();
1949 return rect.translated(m_matrix[2][0], m_matrix[2][1]);
1952 qreal x = m_matrix[0][0] *
rect.x() + m_matrix[2][0];
1953 qreal y = m_matrix[1][1] *
rect.y() + m_matrix[2][1];
1965 }
else if (
t <
TxProject || !needsPerspectiveClipping(
rect, *
this)) {
1973 xmin = qMin(xmin,
x);
1974 ymin = qMin(ymin,
y);
1975 xmax = qMax(xmax,
x);
1976 ymax = qMax(ymax,
y);
1978 xmin = qMin(xmin,
x);
1979 ymin = qMin(ymin,
y);
1980 xmax = qMax(xmax,
x);
1981 ymax = qMax(ymax,
y);
1983 xmin = qMin(xmin,
x);
1984 ymin = qMin(ymin,
y);
1985 xmax = qMax(xmax,
x);
1986 ymax = qMax(ymax,
y);
1987 return QRectF(xmin, ymin, xmax-xmin, ymax - ymin);
1991 return map(
path).boundingRect();
2036 qreal fx = 0, fy = 0;
2056 if (m_dirty ==
TxNone || m_dirty < m_type)
2069 const qreal dot = m_matrix[0][0] * m_matrix[1][0] + m_matrix[0][1] * m_matrix[1][1];
2294 *
scale = qMax(xScale, yScale);
2311 if (
qAbs(xScale1 - yScale1) >
qAbs(xScale2 - yScale2)) {
2326 if (
s.version() == 1) {
2327 float m11, m12, m21, m22, dx, dy;
2328 s >> m11;
s >> m12;
s >> m21;
s >> m22;
s >> dx;
s >> dy;
2330 m.m_matrix[0][0] = m11;
2331 m.m_matrix[0][1] = m12;
2332 m.m_matrix[1][0] = m21;
2333 m.m_matrix[1][1] = m22;
2334 m.m_matrix[2][0] = dx;
2335 m.m_matrix[2][1] = dy;
2337 s >>
m.m_matrix[0][0];
2338 s >>
m.m_matrix[0][1];
2339 s >>
m.m_matrix[1][0];
2340 s >>
m.m_matrix[1][1];
2341 s >>
m.m_matrix[2][0];
2342 s >>
m.m_matrix[2][1];
2344 m.m_matrix[0][2] = 0;
2345 m.m_matrix[1][2] = 0;
2346 m.m_matrix[2][2] = 1;
2352 if (
s.version() == 1) {
2353 s << (float)
m.m_matrix[0][0]
2354 << (
float)
m.m_matrix[0][1]
2355 << (float)
m.m_matrix[1][0]
2356 << (
float)
m.m_matrix[1][1]
2357 << (float)
m.m_matrix[2][0]
2358 << (
float)
m.m_matrix[2][1];
2360 s <<
m.m_matrix[0][0]
2365 <<
m.m_matrix[2][1];
small capitals from c petite p scientific i
[1]
static QBezier fromPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4)
QPolygonF toPolygon(qreal bezier_flattening_threshold=0.5) const
The QDataStream class provides serialization of binary data to a QIODevice.
operator>>(QDataStream &ds, qfloat16 &f)
operator<<(QDataStream &ds, qfloat16 f)
The QDebug class provides an output stream for debugging information.
Convenience class for custom QDebug operators.
The QLineF class provides a two-dimensional vector using floating point precision.
The QLine class provides a two-dimensional vector using integer precision.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
qsizetype count() const noexcept
bool qFuzzyCompare(const QMatrix4x4 &m1, const QMatrix4x4 &m2)
The QPainterPath::Element class specifies the position and type of a subpath.
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
void translate(qreal dx, qreal dy)
The QPointF class defines a point in the plane using floating point precision.
The QPoint class defines a point in the plane using integer precision.
The QPolygonF class provides a list of points using floating point precision. \inmodule QtGui.
QPolygon Q_GUI_EXPORT toPolygon() const
The QPolygon class provides a list of points using integer precision. \inmodule QtGui.
The QRectF class defines a finite rectangle in the plane using floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
constexpr bool isEmpty() const noexcept
The QRegion class specifies a clip region for a painter.
void translate(int dx, int dy)
const T * constData() const
void reserve(qsizetype sz)
The QVariant class acts like a union for the most common Qt data types.
static auto fromValue(const T &value) -> std::enable_if_t< std::is_copy_constructible_v< T >, QVariant >
QHash< int, QWidget * > hash
[35multi]
bool qFuzzyIsNull(qfloat16 f) noexcept
bool qIsNaN(qfloat16 f) noexcept
int qRound(qfloat16 d) noexcept
QT_END_INCLUDE_NAMESPACE typedef double qreal
constexpr float qDegreesToRadians(float degrees)
QRect qt_mapFillRect(const QRectF &rect, const QTransform &xf)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
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
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum GLenum transform
GLfixed GLfixed GLfixed y2
GLsizei const GLchar *const * path
GLenum GLenum GLenum GLenum GLenum scale
const QPointF toPoint() const
QHomogeneousCoordinate(qreal x_, qreal y_, qreal w_)