qgenericmatrix.sip 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. // qgenericmatrix.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtGui Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. // The implementation of QMatrix4x3.
  22. class QMatrix4x3
  23. {
  24. %TypeHeaderCode
  25. #include <qgenericmatrix.h>
  26. %End
  27. %PickleCode
  28. PYQT_FLOAT data[12];
  29. // We want the data in row-major order.
  30. sipCpp->copyDataTo(data);
  31. sipRes = Py_BuildValue("dddddddddddd",
  32. (double)data[0], (double)data[1], (double)data[2],
  33. (double)data[3], (double)data[4], (double)data[5],
  34. (double)data[6], (double)data[7], (double)data[8],
  35. (double)data[9], (double)data[10], (double)data[11]);
  36. %End
  37. public:
  38. QMatrix4x3();
  39. QMatrix4x3(const QMatrix4x3 &other);
  40. explicit QMatrix4x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  41. %MethodCode
  42. PYQT_FLOAT values[12];
  43. if ((sipError = qtgui_matrixDataFromSequence(a0, 12, values)) == sipErrorNone)
  44. sipCpp = new QMatrix4x3(values);
  45. %End
  46. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  47. %MethodCode
  48. bool bad = false;
  49. int i;
  50. PyObject *m[12];
  51. PYQT_FLOAT data[12];
  52. // The raw data is in column-major order but we want row-major order.
  53. sipCpp->copyDataTo(data);
  54. for (i = 0; i < 12; ++i)
  55. {
  56. m[i] = PyFloat_FromDouble(data[i]);
  57. if (!m[i])
  58. bad = true;
  59. }
  60. if (!bad)
  61. {
  62. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix4x3("
  63. "%R, %R, %R, "
  64. "%R, %R, %R, "
  65. "%R, %R, %R, "
  66. "%R, %R, %R)",
  67. m[0], m[1], m[2],
  68. m[3], m[4], m[5],
  69. m[6], m[7], m[8],
  70. m[9], m[10], m[11]);
  71. }
  72. for (i = 0; i < 12; ++i)
  73. Py_XDECREF(m[i]);
  74. %End
  75. SIP_PYLIST data() /TypeHint="List[float]"/;
  76. %MethodCode
  77. sipError = qtgui_matrixDataAsList(12, sipCpp->constData(), &sipRes);
  78. %End
  79. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  80. %MethodCode
  81. PYQT_FLOAT values[12];
  82. sipCpp->copyDataTo(values);
  83. sipError = qtgui_matrixDataAsList(12, values, &sipRes);
  84. %End
  85. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  86. %MethodCode
  87. int row, column;
  88. if ((sipError = qtgui_matrixParseIndex(a0, 4, 3, &row, &column)) == sipErrorNone)
  89. {
  90. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  91. if (!sipRes)
  92. sipError = sipErrorFail;
  93. }
  94. %End
  95. void __setitem__(SIP_PYOBJECT, float);
  96. %MethodCode
  97. int row, column;
  98. if ((sipError = qtgui_matrixParseIndex(a0, 4, 3, &row, &column)) == sipErrorNone)
  99. sipCpp->operator()(row, column) = a1;
  100. %End
  101. bool isIdentity() const;
  102. void setToIdentity();
  103. void fill(float value);
  104. QMatrix3x4 transposed() const;
  105. QMatrix4x3 &operator+=(const QMatrix4x3 &);
  106. QMatrix4x3 &operator-=(const QMatrix4x3 &);
  107. QMatrix4x3 &operator*=(float);
  108. QMatrix4x3 &operator/=(float);
  109. bool operator==(const QMatrix4x3 &) const;
  110. bool operator!=(const QMatrix4x3 &) const;
  111. };
  112. QDataStream &operator<<(QDataStream &, const QMatrix4x3 &) /ReleaseGIL/;
  113. QDataStream &operator>>(QDataStream &, QMatrix4x3 & /Constrained/) /ReleaseGIL/;
  114. // The implementation of QMatrix4x2.
  115. class QMatrix4x2
  116. {
  117. %TypeHeaderCode
  118. #include <qgenericmatrix.h>
  119. %End
  120. %PickleCode
  121. PYQT_FLOAT data[8];
  122. // We want the data in row-major order.
  123. sipCpp->copyDataTo(data);
  124. sipRes = Py_BuildValue("dddddddd",
  125. (double)data[0], (double)data[1],
  126. (double)data[2], (double)data[3],
  127. (double)data[4], (double)data[5],
  128. (double)data[6], (double)data[7]);
  129. %End
  130. public:
  131. QMatrix4x2();
  132. QMatrix4x2(const QMatrix4x2 &other);
  133. explicit QMatrix4x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  134. %MethodCode
  135. PYQT_FLOAT values[8];
  136. if ((sipError = qtgui_matrixDataFromSequence(a0, 8, values)) == sipErrorNone)
  137. sipCpp = new QMatrix4x2(values);
  138. %End
  139. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  140. %MethodCode
  141. bool bad = false;
  142. int i;
  143. PyObject *m[8];
  144. PYQT_FLOAT data[8];
  145. // The raw data is in column-major order but we want row-major order.
  146. sipCpp->copyDataTo(data);
  147. for (i = 0; i < 8; ++i)
  148. {
  149. m[i] = PyFloat_FromDouble(data[i]);
  150. if (!m[i])
  151. bad = true;
  152. }
  153. if (!bad)
  154. {
  155. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix4x2("
  156. "%R, %R, "
  157. "%R, %R, "
  158. "%R, %R, "
  159. "%R, %R)",
  160. m[0], m[1],
  161. m[2], m[3],
  162. m[4], m[5],
  163. m[6], m[7]);
  164. }
  165. for (i = 0; i < 8; ++i)
  166. Py_XDECREF(m[i]);
  167. %End
  168. SIP_PYLIST data() /TypeHint="List[float]"/;
  169. %MethodCode
  170. sipError = qtgui_matrixDataAsList(8, sipCpp->constData(), &sipRes);
  171. %End
  172. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  173. %MethodCode
  174. PYQT_FLOAT values[8];
  175. sipCpp->copyDataTo(values);
  176. sipError = qtgui_matrixDataAsList(8, values, &sipRes);
  177. %End
  178. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  179. %MethodCode
  180. int row, column;
  181. if ((sipError = qtgui_matrixParseIndex(a0, 4, 2, &row, &column)) == sipErrorNone)
  182. {
  183. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  184. if (!sipRes)
  185. sipError = sipErrorFail;
  186. }
  187. %End
  188. void __setitem__(SIP_PYOBJECT, float);
  189. %MethodCode
  190. int row, column;
  191. if ((sipError = qtgui_matrixParseIndex(a0, 4, 2, &row, &column)) == sipErrorNone)
  192. sipCpp->operator()(row, column) = a1;
  193. %End
  194. bool isIdentity() const;
  195. void setToIdentity();
  196. void fill(float value);
  197. QMatrix2x4 transposed() const;
  198. QMatrix4x2 &operator+=(const QMatrix4x2 &);
  199. QMatrix4x2 &operator-=(const QMatrix4x2 &);
  200. QMatrix4x2 &operator*=(float);
  201. QMatrix4x2 &operator/=(float);
  202. bool operator==(const QMatrix4x2 &) const;
  203. bool operator!=(const QMatrix4x2 &) const;
  204. };
  205. QDataStream &operator<<(QDataStream &, const QMatrix4x2 &) /ReleaseGIL/;
  206. QDataStream &operator>>(QDataStream &, QMatrix4x2 & /Constrained/) /ReleaseGIL/;
  207. // The implementation of QMatrix3x4.
  208. class QMatrix3x4
  209. {
  210. %TypeHeaderCode
  211. #include <qgenericmatrix.h>
  212. %End
  213. %PickleCode
  214. PYQT_FLOAT data[12];
  215. // We want the data in row-major order.
  216. sipCpp->copyDataTo(data);
  217. sipRes = Py_BuildValue("dddddddddddd",
  218. (double)data[0], (double)data[1], (double)data[2],
  219. (double)data[3], (double)data[4], (double)data[5],
  220. (double)data[6], (double)data[7], (double)data[8],
  221. (double)data[9], (double)data[10], (double)data[11]);
  222. %End
  223. public:
  224. QMatrix3x4();
  225. QMatrix3x4(const QMatrix3x4 &other);
  226. explicit QMatrix3x4(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  227. %MethodCode
  228. PYQT_FLOAT values[12];
  229. if ((sipError = qtgui_matrixDataFromSequence(a0, 12, values)) == sipErrorNone)
  230. sipCpp = new QMatrix3x4(values);
  231. %End
  232. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  233. %MethodCode
  234. bool bad = false;
  235. int i;
  236. PyObject *m[12];
  237. PYQT_FLOAT data[12];
  238. // The raw data is in column-major order but we want row-major order.
  239. sipCpp->copyDataTo(data);
  240. for (i = 0; i < 12; ++i)
  241. {
  242. m[i] = PyFloat_FromDouble(data[i]);
  243. if (!m[i])
  244. bad = true;
  245. }
  246. if (!bad)
  247. {
  248. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x4("
  249. "%R, %R, %R, "
  250. "%R, %R, %R, "
  251. "%R, %R, %R, "
  252. "%R, %R, %R)",
  253. m[0], m[1], m[2],
  254. m[3], m[4], m[5],
  255. m[6], m[7], m[8],
  256. m[9], m[10], m[11]);
  257. }
  258. for (i = 0; i < 12; ++i)
  259. Py_XDECREF(m[i]);
  260. %End
  261. SIP_PYLIST data() /TypeHint="List[float]"/;
  262. %MethodCode
  263. sipError = qtgui_matrixDataAsList(12, sipCpp->constData(), &sipRes);
  264. %End
  265. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  266. %MethodCode
  267. PYQT_FLOAT values[12];
  268. sipCpp->copyDataTo(values);
  269. sipError = qtgui_matrixDataAsList(12, values, &sipRes);
  270. %End
  271. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  272. %MethodCode
  273. int row, column;
  274. if ((sipError = qtgui_matrixParseIndex(a0, 3, 4, &row, &column)) == sipErrorNone)
  275. {
  276. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  277. if (!sipRes)
  278. sipError = sipErrorFail;
  279. }
  280. %End
  281. void __setitem__(SIP_PYOBJECT, float);
  282. %MethodCode
  283. int row, column;
  284. if ((sipError = qtgui_matrixParseIndex(a0, 3, 4, &row, &column)) == sipErrorNone)
  285. sipCpp->operator()(row, column) = a1;
  286. %End
  287. bool isIdentity() const;
  288. void setToIdentity();
  289. void fill(float value);
  290. QMatrix4x3 transposed() const;
  291. QMatrix3x4 &operator+=(const QMatrix3x4 &);
  292. QMatrix3x4 &operator-=(const QMatrix3x4 &);
  293. QMatrix3x4 &operator*=(float);
  294. QMatrix3x4 &operator/=(float);
  295. bool operator==(const QMatrix3x4 &) const;
  296. bool operator!=(const QMatrix3x4 &) const;
  297. };
  298. QDataStream &operator<<(QDataStream &, const QMatrix3x4 &) /ReleaseGIL/;
  299. QDataStream &operator>>(QDataStream &, QMatrix3x4 & /Constrained/) /ReleaseGIL/;
  300. // The implementation of QMatrix3x3.
  301. class QMatrix3x3
  302. {
  303. %TypeHeaderCode
  304. #include <qgenericmatrix.h>
  305. %End
  306. %PickleCode
  307. PYQT_FLOAT data[9];
  308. // We want the data in row-major order.
  309. sipCpp->copyDataTo(data);
  310. sipRes = Py_BuildValue("ddddddddd",
  311. (double)data[0], (double)data[1], (double)data[2],
  312. (double)data[3], (double)data[4], (double)data[5],
  313. (double)data[6], (double)data[7], (double)data[8]);
  314. %End
  315. public:
  316. QMatrix3x3();
  317. QMatrix3x3(const QMatrix3x3 &other);
  318. explicit QMatrix3x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  319. %MethodCode
  320. PYQT_FLOAT values[9];
  321. if ((sipError = qtgui_matrixDataFromSequence(a0, 9, values)) == sipErrorNone)
  322. sipCpp = new QMatrix3x3(values);
  323. %End
  324. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  325. %MethodCode
  326. bool bad = false;
  327. int i;
  328. PyObject *m[9];
  329. PYQT_FLOAT data[9];
  330. // The raw data is in column-major order but we want row-major order.
  331. sipCpp->copyDataTo(data);
  332. for (i = 0; i < 9; ++i)
  333. {
  334. m[i] = PyFloat_FromDouble(data[i]);
  335. if (!m[i])
  336. bad = true;
  337. }
  338. if (!bad)
  339. {
  340. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x3("
  341. "%R, %R, %R, "
  342. "%R, %R, %R, "
  343. "%R, %R, %R)",
  344. m[0], m[1], m[2],
  345. m[3], m[4], m[5],
  346. m[6], m[7], m[8]);
  347. }
  348. for (i = 0; i < 9; ++i)
  349. Py_XDECREF(m[i]);
  350. %End
  351. SIP_PYLIST data() /TypeHint="List[float]"/;
  352. %MethodCode
  353. sipError = qtgui_matrixDataAsList(9, sipCpp->constData(), &sipRes);
  354. %End
  355. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  356. %MethodCode
  357. PYQT_FLOAT values[9];
  358. sipCpp->copyDataTo(values);
  359. sipError = qtgui_matrixDataAsList(9, values, &sipRes);
  360. %End
  361. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  362. %MethodCode
  363. int row, column;
  364. if ((sipError = qtgui_matrixParseIndex(a0, 3, 3, &row, &column)) == sipErrorNone)
  365. {
  366. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  367. if (!sipRes)
  368. sipError = sipErrorFail;
  369. }
  370. %End
  371. void __setitem__(SIP_PYOBJECT, float);
  372. %MethodCode
  373. int row, column;
  374. if ((sipError = qtgui_matrixParseIndex(a0, 3, 3, &row, &column)) == sipErrorNone)
  375. sipCpp->operator()(row, column) = a1;
  376. %End
  377. bool isIdentity() const;
  378. void setToIdentity();
  379. void fill(float value);
  380. QMatrix3x3 transposed() const;
  381. QMatrix3x3 &operator+=(const QMatrix3x3 &);
  382. QMatrix3x3 &operator-=(const QMatrix3x3 &);
  383. QMatrix3x3 &operator*=(float);
  384. QMatrix3x3 &operator/=(float);
  385. bool operator==(const QMatrix3x3 &) const;
  386. bool operator!=(const QMatrix3x3 &) const;
  387. };
  388. QDataStream &operator<<(QDataStream &, const QMatrix3x3 &) /ReleaseGIL/;
  389. QDataStream &operator>>(QDataStream &, QMatrix3x3 & /Constrained/) /ReleaseGIL/;
  390. // The implementation of QMatrix3x2.
  391. class QMatrix3x2
  392. {
  393. %TypeHeaderCode
  394. #include <qgenericmatrix.h>
  395. %End
  396. %PickleCode
  397. PYQT_FLOAT data[6];
  398. // We want the data in row-major order.
  399. sipCpp->copyDataTo(data);
  400. sipRes = Py_BuildValue("dddddd",
  401. (double)data[0], (double)data[1],
  402. (double)data[2], (double)data[3],
  403. (double)data[4], (double)data[5]);
  404. %End
  405. public:
  406. QMatrix3x2();
  407. QMatrix3x2(const QMatrix3x2 &other);
  408. explicit QMatrix3x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  409. %MethodCode
  410. PYQT_FLOAT values[6];
  411. if ((sipError = qtgui_matrixDataFromSequence(a0, 6, values)) == sipErrorNone)
  412. sipCpp = new QMatrix3x2(values);
  413. %End
  414. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  415. %MethodCode
  416. bool bad = false;
  417. int i;
  418. PyObject *m[6];
  419. PYQT_FLOAT data[6];
  420. // The raw data is in column-major order but we want row-major order.
  421. sipCpp->copyDataTo(data);
  422. for (i = 0; i < 6; ++i)
  423. {
  424. m[i] = PyFloat_FromDouble(data[i]);
  425. if (!m[i])
  426. bad = true;
  427. }
  428. if (!bad)
  429. {
  430. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix3x2("
  431. "%R, %R, "
  432. "%R, %R, "
  433. "%R, %R)",
  434. m[0], m[1],
  435. m[2], m[3],
  436. m[4], m[5]);
  437. }
  438. for (i = 0; i < 6; ++i)
  439. Py_XDECREF(m[i]);
  440. %End
  441. SIP_PYLIST data() /TypeHint="List[float]"/;
  442. %MethodCode
  443. sipError = qtgui_matrixDataAsList(6, sipCpp->constData(), &sipRes);
  444. %End
  445. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  446. %MethodCode
  447. PYQT_FLOAT values[6];
  448. sipCpp->copyDataTo(values);
  449. sipError = qtgui_matrixDataAsList(6, values, &sipRes);
  450. %End
  451. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  452. %MethodCode
  453. int row, column;
  454. if ((sipError = qtgui_matrixParseIndex(a0, 3, 2, &row, &column)) == sipErrorNone)
  455. {
  456. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  457. if (!sipRes)
  458. sipError = sipErrorFail;
  459. }
  460. %End
  461. void __setitem__(SIP_PYOBJECT, float);
  462. %MethodCode
  463. int row, column;
  464. if ((sipError = qtgui_matrixParseIndex(a0, 3, 2, &row, &column)) == sipErrorNone)
  465. sipCpp->operator()(row, column) = a1;
  466. %End
  467. bool isIdentity() const;
  468. void setToIdentity();
  469. void fill(float value);
  470. QMatrix2x3 transposed() const;
  471. QMatrix3x2 &operator+=(const QMatrix3x2 &);
  472. QMatrix3x2 &operator-=(const QMatrix3x2 &);
  473. QMatrix3x2 &operator*=(float);
  474. QMatrix3x2 &operator/=(float);
  475. bool operator==(const QMatrix3x2 &) const;
  476. bool operator!=(const QMatrix3x2 &) const;
  477. };
  478. QDataStream &operator<<(QDataStream &, const QMatrix3x2 &) /ReleaseGIL/;
  479. QDataStream &operator>>(QDataStream &, QMatrix3x2 & /Constrained/) /ReleaseGIL/;
  480. // The implementation of QMatrix2x4.
  481. class QMatrix2x4
  482. {
  483. %TypeHeaderCode
  484. #include <qgenericmatrix.h>
  485. %End
  486. %PickleCode
  487. PYQT_FLOAT data[8];
  488. // We want the data in row-major order.
  489. sipCpp->copyDataTo(data);
  490. sipRes = Py_BuildValue("dddddddd",
  491. (double)data[0], (double)data[1], (double)data[2], (double)data[3],
  492. (double)data[4], (double)data[5], (double)data[6], (double)data[7]);
  493. %End
  494. public:
  495. QMatrix2x4();
  496. QMatrix2x4(const QMatrix2x4 &other);
  497. explicit QMatrix2x4(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  498. %MethodCode
  499. PYQT_FLOAT values[8];
  500. if ((sipError = qtgui_matrixDataFromSequence(a0, 8, values)) == sipErrorNone)
  501. sipCpp = new QMatrix2x4(values);
  502. %End
  503. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  504. %MethodCode
  505. bool bad = false;
  506. int i;
  507. PyObject *m[8];
  508. PYQT_FLOAT data[8];
  509. // The raw data is in column-major order but we want row-major order.
  510. sipCpp->copyDataTo(data);
  511. for (i = 0; i < 8; ++i)
  512. {
  513. m[i] = PyFloat_FromDouble(data[i]);
  514. if (!m[i])
  515. bad = true;
  516. }
  517. if (!bad)
  518. {
  519. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x4("
  520. "%R, %R, %R, %R, "
  521. "%R, %R, %R, %R)",
  522. m[0], m[1], m[2], m[3],
  523. m[4], m[5], m[6], m[7]);
  524. }
  525. for (i = 0; i < 8; ++i)
  526. Py_XDECREF(m[i]);
  527. %End
  528. SIP_PYLIST data() /TypeHint="List[float]"/;
  529. %MethodCode
  530. sipError = qtgui_matrixDataAsList(8, sipCpp->constData(), &sipRes);
  531. %End
  532. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  533. %MethodCode
  534. PYQT_FLOAT values[8];
  535. sipCpp->copyDataTo(values);
  536. sipError = qtgui_matrixDataAsList(8, values, &sipRes);
  537. %End
  538. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  539. %MethodCode
  540. int row, column;
  541. if ((sipError = qtgui_matrixParseIndex(a0, 2, 4, &row, &column)) == sipErrorNone)
  542. {
  543. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  544. if (!sipRes)
  545. sipError = sipErrorFail;
  546. }
  547. %End
  548. void __setitem__(SIP_PYOBJECT, float);
  549. %MethodCode
  550. int row, column;
  551. if ((sipError = qtgui_matrixParseIndex(a0, 2, 4, &row, &column)) == sipErrorNone)
  552. sipCpp->operator()(row, column) = a1;
  553. %End
  554. bool isIdentity() const;
  555. void setToIdentity();
  556. void fill(float value);
  557. QMatrix4x2 transposed() const;
  558. QMatrix2x4 &operator+=(const QMatrix2x4 &);
  559. QMatrix2x4 &operator-=(const QMatrix2x4 &);
  560. QMatrix2x4 &operator*=(float);
  561. QMatrix2x4 &operator/=(float);
  562. bool operator==(const QMatrix2x4 &) const;
  563. bool operator!=(const QMatrix2x4 &) const;
  564. };
  565. QDataStream &operator<<(QDataStream &, const QMatrix2x4 &) /ReleaseGIL/;
  566. QDataStream &operator>>(QDataStream &, QMatrix2x4 & /Constrained/) /ReleaseGIL/;
  567. // The implementation of QMatrix2x3.
  568. class QMatrix2x3
  569. {
  570. %TypeHeaderCode
  571. #include <qgenericmatrix.h>
  572. %End
  573. %PickleCode
  574. PYQT_FLOAT data[6];
  575. // We want the data in row-major order.
  576. sipCpp->copyDataTo(data);
  577. sipRes = Py_BuildValue("dddddd",
  578. (double)data[0], (double)data[1], (double)data[2],
  579. (double)data[3], (double)data[4], (double)data[5]);
  580. %End
  581. public:
  582. QMatrix2x3();
  583. QMatrix2x3(const QMatrix2x3 &other);
  584. explicit QMatrix2x3(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  585. %MethodCode
  586. PYQT_FLOAT values[6];
  587. if ((sipError = qtgui_matrixDataFromSequence(a0, 6, values)) == sipErrorNone)
  588. sipCpp = new QMatrix2x3(values);
  589. %End
  590. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  591. %MethodCode
  592. bool bad = false;
  593. int i;
  594. PyObject *m[6];
  595. PYQT_FLOAT data[6];
  596. // The raw data is in column-major order but we want row-major order.
  597. sipCpp->copyDataTo(data);
  598. for (i = 0; i < 6; ++i)
  599. {
  600. m[i] = PyFloat_FromDouble(data[i]);
  601. if (!m[i])
  602. bad = true;
  603. }
  604. if (!bad)
  605. {
  606. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x3("
  607. "%R, %R, %R, "
  608. "%R, %R, %R)",
  609. m[0], m[1], m[2],
  610. m[3], m[4], m[5]);
  611. }
  612. for (i = 0; i < 6; ++i)
  613. Py_XDECREF(m[i]);
  614. %End
  615. SIP_PYLIST data() /TypeHint="List[float]"/;
  616. %MethodCode
  617. sipError = qtgui_matrixDataAsList(6, sipCpp->constData(), &sipRes);
  618. %End
  619. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  620. %MethodCode
  621. PYQT_FLOAT values[6];
  622. sipCpp->copyDataTo(values);
  623. sipError = qtgui_matrixDataAsList(6, values, &sipRes);
  624. %End
  625. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  626. %MethodCode
  627. int row, column;
  628. if ((sipError = qtgui_matrixParseIndex(a0, 2, 3, &row, &column)) == sipErrorNone)
  629. {
  630. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  631. if (!sipRes)
  632. sipError = sipErrorFail;
  633. }
  634. %End
  635. void __setitem__(SIP_PYOBJECT, float);
  636. %MethodCode
  637. int row, column;
  638. if ((sipError = qtgui_matrixParseIndex(a0, 2, 3, &row, &column)) == sipErrorNone)
  639. sipCpp->operator()(row, column) = a1;
  640. %End
  641. bool isIdentity() const;
  642. void setToIdentity();
  643. void fill(float value);
  644. QMatrix3x2 transposed() const;
  645. QMatrix2x3 &operator+=(const QMatrix2x3 &);
  646. QMatrix2x3 &operator-=(const QMatrix2x3 &);
  647. QMatrix2x3 &operator*=(float);
  648. QMatrix2x3 &operator/=(float);
  649. bool operator==(const QMatrix2x3 &) const;
  650. bool operator!=(const QMatrix2x3 &) const;
  651. };
  652. QDataStream &operator<<(QDataStream &, const QMatrix2x3 &) /ReleaseGIL/;
  653. QDataStream &operator>>(QDataStream &, QMatrix2x3 & /Constrained/) /ReleaseGIL/;
  654. // The implementation of QMatrix2x2.
  655. class QMatrix2x2
  656. {
  657. %TypeHeaderCode
  658. #include <qgenericmatrix.h>
  659. %End
  660. %PickleCode
  661. PYQT_FLOAT data[4];
  662. // We want the data in row-major order.
  663. sipCpp->copyDataTo(data);
  664. sipRes = Py_BuildValue("dddd",
  665. (double)data[0], (double)data[1],
  666. (double)data[2], (double)data[3]);
  667. %End
  668. public:
  669. QMatrix2x2();
  670. QMatrix2x2(const QMatrix2x2 &other);
  671. explicit QMatrix2x2(SIP_PYOBJECT values /TypeHint="Sequence[float]"/);
  672. %MethodCode
  673. PYQT_FLOAT values[4];
  674. if ((sipError = qtgui_matrixDataFromSequence(a0, 4, values)) == sipErrorNone)
  675. sipCpp = new QMatrix2x2(values);
  676. %End
  677. SIP_PYOBJECT __repr__() const /TypeHint="str"/;
  678. %MethodCode
  679. bool bad = false;
  680. int i;
  681. PyObject *m[4];
  682. PYQT_FLOAT data[4];
  683. // The raw data is in column-major order but we want row-major order.
  684. sipCpp->copyDataTo(data);
  685. for (i = 0; i < 4; ++i)
  686. {
  687. m[i] = PyFloat_FromDouble(data[i]);
  688. if (!m[i])
  689. bad = true;
  690. }
  691. if (!bad)
  692. {
  693. sipRes = PyUnicode_FromFormat("PyQt6.QtGui.QMatrix2x2("
  694. "%R, %R, "
  695. "%R, %R)",
  696. m[0], m[1],
  697. m[2], m[3]);
  698. }
  699. for (i = 0; i < 4; ++i)
  700. Py_XDECREF(m[i]);
  701. %End
  702. SIP_PYLIST data() /TypeHint="List[float]"/;
  703. %MethodCode
  704. sipError = qtgui_matrixDataAsList(4, sipCpp->constData(), &sipRes);
  705. %End
  706. SIP_PYLIST copyDataTo() const /TypeHint="List[float]"/;
  707. %MethodCode
  708. PYQT_FLOAT values[4];
  709. sipCpp->copyDataTo(values);
  710. sipError = qtgui_matrixDataAsList(4, values, &sipRes);
  711. %End
  712. SIP_PYOBJECT __getitem__(SIP_PYOBJECT) const;
  713. %MethodCode
  714. int row, column;
  715. if ((sipError = qtgui_matrixParseIndex(a0, 2, 2, &row, &column)) == sipErrorNone)
  716. {
  717. sipRes = PyFloat_FromDouble(sipCpp->operator()(row, column));
  718. if (!sipRes)
  719. sipError = sipErrorFail;
  720. }
  721. %End
  722. void __setitem__(SIP_PYOBJECT, float);
  723. %MethodCode
  724. int row, column;
  725. if ((sipError = qtgui_matrixParseIndex(a0, 2, 2, &row, &column)) == sipErrorNone)
  726. sipCpp->operator()(row, column) = a1;
  727. %End
  728. bool isIdentity() const;
  729. void setToIdentity();
  730. void fill(float value);
  731. QMatrix2x2 transposed() const;
  732. QMatrix2x2 &operator+=(const QMatrix2x2 &);
  733. QMatrix2x2 &operator-=(const QMatrix2x2 &);
  734. QMatrix2x2 &operator*=(float);
  735. QMatrix2x2 &operator/=(float);
  736. bool operator==(const QMatrix2x2 &) const;
  737. bool operator!=(const QMatrix2x2 &) const;
  738. };
  739. QDataStream &operator<<(QDataStream &, const QMatrix2x2 &) /ReleaseGIL/;
  740. QDataStream &operator>>(QDataStream &, QMatrix2x2 & /Constrained/) /ReleaseGIL/;