qpainter.sip 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. // qpainter.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. class QPainter
  22. {
  23. %TypeHeaderCode
  24. #include <qpainter.h>
  25. %End
  26. %TypeCode
  27. // Return an array on the heap of class instances extracted from a set of
  28. // Python arguments.
  29. template<class TYPE>
  30. static TYPE *qtgui_inst_array(const TYPE *first, PyObject *t, sipTypeDef *td)
  31. {
  32. TYPE *arr = new TYPE[1 + PyTuple_Size(t)];
  33. arr[0] = *first;
  34. for (Py_ssize_t i = 0; i < PyTuple_Size(t); ++i)
  35. {
  36. int iserr = 0, state;
  37. TYPE *itm;
  38. itm = reinterpret_cast<TYPE *>(sipForceConvertToType(PyTuple_GetItem(t, i), td, 0, SIP_NOT_NONE, &state, &iserr));
  39. if (iserr)
  40. {
  41. sipReleaseType(itm, td, state);
  42. PyErr_Format(PyExc_TypeError, "each argument must be an instance of %s", sipPyTypeName(sipTypeAsPyTypeObject(td)));
  43. delete[] arr;
  44. return 0;
  45. }
  46. arr[1 + i] = *itm;
  47. sipReleaseType(itm, td, state);
  48. }
  49. return arr;
  50. }
  51. %End
  52. public:
  53. enum RenderHint /BaseType=Flag/
  54. {
  55. Antialiasing,
  56. TextAntialiasing,
  57. SmoothPixmapTransform,
  58. LosslessImageRendering,
  59. %If (Qt_6_1_0 -)
  60. VerticalSubpixelPositioning,
  61. %End
  62. %If (Qt_6_4_0 -)
  63. NonCosmeticBrushPatterns,
  64. %End
  65. };
  66. typedef QFlags<QPainter::RenderHint> RenderHints;
  67. QPainter();
  68. explicit QPainter(QPaintDevice *);
  69. ~QPainter();
  70. SIP_PYOBJECT __enter__();
  71. %MethodCode
  72. // Check a device was passed.
  73. if (sipCpp->isActive())
  74. {
  75. // Just return a reference to self.
  76. sipRes = sipSelf;
  77. Py_INCREF(sipRes);
  78. }
  79. else
  80. {
  81. PyErr_SetString(PyExc_ValueError, "QPainter must be created with a device");
  82. sipRes = 0;
  83. }
  84. %End
  85. void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
  86. %MethodCode
  87. sipCpp->end();
  88. %End
  89. QPaintDevice *device() const;
  90. bool begin(QPaintDevice *);
  91. bool end();
  92. bool isActive() const;
  93. enum CompositionMode
  94. {
  95. CompositionMode_SourceOver,
  96. CompositionMode_DestinationOver,
  97. CompositionMode_Clear,
  98. CompositionMode_Source,
  99. CompositionMode_Destination,
  100. CompositionMode_SourceIn,
  101. CompositionMode_DestinationIn,
  102. CompositionMode_SourceOut,
  103. CompositionMode_DestinationOut,
  104. CompositionMode_SourceAtop,
  105. CompositionMode_DestinationAtop,
  106. CompositionMode_Xor,
  107. CompositionMode_Plus,
  108. CompositionMode_Multiply,
  109. CompositionMode_Screen,
  110. CompositionMode_Overlay,
  111. CompositionMode_Darken,
  112. CompositionMode_Lighten,
  113. CompositionMode_ColorDodge,
  114. CompositionMode_ColorBurn,
  115. CompositionMode_HardLight,
  116. CompositionMode_SoftLight,
  117. CompositionMode_Difference,
  118. CompositionMode_Exclusion,
  119. RasterOp_SourceOrDestination,
  120. RasterOp_SourceAndDestination,
  121. RasterOp_SourceXorDestination,
  122. RasterOp_NotSourceAndNotDestination,
  123. RasterOp_NotSourceOrNotDestination,
  124. RasterOp_NotSourceXorDestination,
  125. RasterOp_NotSource,
  126. RasterOp_NotSourceAndDestination,
  127. RasterOp_SourceAndNotDestination,
  128. RasterOp_NotSourceOrDestination,
  129. RasterOp_SourceOrNotDestination,
  130. RasterOp_ClearDestination,
  131. RasterOp_SetDestination,
  132. RasterOp_NotDestination,
  133. };
  134. void setCompositionMode(QPainter::CompositionMode mode);
  135. QPainter::CompositionMode compositionMode() const;
  136. const QFont &font() const;
  137. void setFont(const QFont &f);
  138. QFontMetrics fontMetrics() const;
  139. QFontInfo fontInfo() const;
  140. void setPen(const QColor &color);
  141. void setPen(const QPen &pen);
  142. void setPen(Qt::PenStyle style);
  143. const QPen &pen() const;
  144. void setBrush(const QBrush &brush);
  145. void setBrush(Qt::BrushStyle style);
  146. const QBrush &brush() const;
  147. void setBackgroundMode(Qt::BGMode mode);
  148. Qt::BGMode backgroundMode() const;
  149. QPoint brushOrigin() const;
  150. void setBrushOrigin(const QPointF &);
  151. void setBackground(const QBrush &bg);
  152. const QBrush &background() const;
  153. QRegion clipRegion() const;
  154. QPainterPath clipPath() const;
  155. void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip);
  156. void setClipRegion(const QRegion &region, Qt::ClipOperation operation = Qt::ReplaceClip);
  157. void setClipPath(const QPainterPath &path, Qt::ClipOperation operation = Qt::ReplaceClip);
  158. void setClipping(bool enable);
  159. bool hasClipping() const;
  160. void save();
  161. void restore();
  162. void scale(qreal sx, qreal sy);
  163. void shear(qreal sh, qreal sv);
  164. void rotate(qreal a);
  165. void translate(const QPointF &offset);
  166. QRect window() const;
  167. void setWindow(const QRect &window);
  168. QRect viewport() const;
  169. void setViewport(const QRect &viewport);
  170. void setViewTransformEnabled(bool enable);
  171. bool viewTransformEnabled() const;
  172. void strokePath(const QPainterPath &path, const QPen &pen);
  173. void fillPath(const QPainterPath &path, const QBrush &brush);
  174. void drawPath(const QPainterPath &path);
  175. void drawPoints(const QPolygonF &points);
  176. void drawPoints(const QPolygon &points);
  177. void drawPoints(const QPointF *points /Array/, int pointCount /ArraySize/);
  178. void drawPoints(const QPointF *point, ... /TypeHint="QPointF"/);
  179. %MethodCode
  180. QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
  181. if (points)
  182. {
  183. sipCpp->drawPoints(points, 1 + PyTuple_Size(a1));
  184. delete[] points;
  185. }
  186. else
  187. sipIsErr = 1;
  188. %End
  189. void drawPoints(const QPoint *points /Array/, int pointCount /ArraySize/);
  190. void drawPoints(const QPoint *point, ... /TypeHint="QPoint"/);
  191. %MethodCode
  192. QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
  193. if (points)
  194. {
  195. sipCpp->drawPoints(points, 1 + PyTuple_Size(a1));
  196. delete[] points;
  197. }
  198. else
  199. sipIsErr = 1;
  200. %End
  201. void drawLines(const QLineF *lines /Array/, int lineCount /ArraySize/);
  202. void drawLines(const QLineF *line, ... /TypeHint="QLineF"/);
  203. %MethodCode
  204. QLineF *lines = qtgui_inst_array<QLineF>(a0, a1, sipType_QLineF);
  205. if (lines)
  206. {
  207. sipCpp->drawLines(lines, 1 + PyTuple_Size(a1));
  208. delete[] lines;
  209. }
  210. else
  211. sipIsErr = 1;
  212. %End
  213. void drawLines(const QPointF *pointPairs /Array/, int lineCount /ArraySize/);
  214. %MethodCode
  215. sipCpp->drawLines(a0, a1 / 2);
  216. %End
  217. void drawLines(const QPointF *pointPair, ... /TypeHint="QPointF"/);
  218. %MethodCode
  219. QPointF *pairs = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
  220. if (pairs)
  221. {
  222. sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2);
  223. delete[] pairs;
  224. }
  225. else
  226. sipIsErr = 1;
  227. %End
  228. void drawLines(const QLine *lines /Array/, int lineCount /ArraySize/);
  229. void drawLines(const QLine *line, ... /TypeHint="QLine"/);
  230. %MethodCode
  231. QLine *lines = qtgui_inst_array<QLine>(a0, a1, sipType_QLine);
  232. if (lines)
  233. {
  234. sipCpp->drawLines(lines, 1 + PyTuple_Size(a1));
  235. delete[] lines;
  236. }
  237. else
  238. sipIsErr = 1;
  239. %End
  240. void drawLines(const QPoint *pointPairs /Array/, int lineCount /ArraySize/);
  241. %MethodCode
  242. sipCpp->drawLines(a0, a1 / 2);
  243. %End
  244. void drawLines(const QPoint *pointPair, ... /TypeHint="QPoint"/);
  245. %MethodCode
  246. QPoint *pairs = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
  247. if (pairs)
  248. {
  249. sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2);
  250. delete[] pairs;
  251. }
  252. else
  253. sipIsErr = 1;
  254. %End
  255. void drawRects(const QRectF *rects /Array/, int rectCount /ArraySize/);
  256. void drawRects(const QRectF *rect, ... /TypeHint="QRectF"/);
  257. %MethodCode
  258. QRectF *rects = qtgui_inst_array<QRectF>(a0, a1, sipType_QRectF);
  259. if (rects)
  260. {
  261. sipCpp->drawRects(rects, 1 + PyTuple_Size(a1));
  262. delete[] rects;
  263. }
  264. else
  265. sipIsErr = 1;
  266. %End
  267. void drawRects(const QRect *rects /Array/, int rectCount /ArraySize/);
  268. void drawRects(const QRect *rect, ... /TypeHint="QRect"/);
  269. %MethodCode
  270. QRect *rects = qtgui_inst_array<QRect>(a0, a1, sipType_QRect);
  271. if (rects)
  272. {
  273. sipCpp->drawRects(rects, 1 + PyTuple_Size(a1));
  274. delete[] rects;
  275. }
  276. else
  277. sipIsErr = 1;
  278. %End
  279. void drawEllipse(const QRectF &r);
  280. void drawEllipse(const QRect &r);
  281. void drawPolyline(const QPolygonF &polyline);
  282. void drawPolyline(const QPolygon &polyline);
  283. void drawPolyline(const QPointF *points /Array/, int pointCount /ArraySize/);
  284. void drawPolyline(const QPointF *point, ... /TypeHint="QPointF"/);
  285. %MethodCode
  286. QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
  287. if (points)
  288. {
  289. sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1));
  290. delete[] points;
  291. }
  292. else
  293. sipIsErr = 1;
  294. %End
  295. void drawPolyline(const QPoint *points /Array/, int pointCount /ArraySize/);
  296. void drawPolyline(const QPoint *point, ... /TypeHint="QPoint"/);
  297. %MethodCode
  298. QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
  299. if (points)
  300. {
  301. sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1));
  302. delete[] points;
  303. }
  304. else
  305. sipIsErr = 1;
  306. %End
  307. void drawPolygon(const QPolygonF &points, Qt::FillRule fillRule = Qt::OddEvenFill);
  308. void drawPolygon(const QPolygon &points, Qt::FillRule fillRule = Qt::OddEvenFill);
  309. void drawPolygon(const QPointF *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill);
  310. void drawPolygon(const QPointF *point, ... /TypeHint="QPointF"/);
  311. %MethodCode
  312. QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
  313. if (points)
  314. {
  315. sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1));
  316. delete[] points;
  317. }
  318. else
  319. sipIsErr = 1;
  320. %End
  321. void drawPolygon(const QPoint *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill);
  322. void drawPolygon(const QPoint *point, ... /TypeHint="QPoint"/);
  323. %MethodCode
  324. QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
  325. if (points)
  326. {
  327. sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1));
  328. delete[] points;
  329. }
  330. else
  331. sipIsErr = 1;
  332. %End
  333. void drawConvexPolygon(const QPolygonF &poly);
  334. void drawConvexPolygon(const QPolygon &poly);
  335. void drawConvexPolygon(const QPointF *points /Array/, int pointCount /ArraySize/);
  336. void drawConvexPolygon(const QPointF *point, ... /TypeHint="QPointF"/);
  337. %MethodCode
  338. QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
  339. if (points)
  340. {
  341. sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1));
  342. delete[] points;
  343. }
  344. else
  345. sipIsErr = 1;
  346. %End
  347. void drawConvexPolygon(const QPoint *points /Array/, int pointCount /ArraySize/);
  348. void drawConvexPolygon(const QPoint *point, ... /TypeHint="QPoint"/);
  349. %MethodCode
  350. QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
  351. if (points)
  352. {
  353. sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1));
  354. delete[] points;
  355. }
  356. else
  357. sipIsErr = 1;
  358. %End
  359. void drawArc(const QRectF &rect, int a, int alen);
  360. void drawPie(const QRectF &rect, int a, int alen);
  361. void drawChord(const QRectF &rect, int a, int alen);
  362. void drawTiledPixmap(const QRectF &rectangle, const QPixmap &pixmap, const QPointF &pos = QPointF());
  363. void drawPicture(const QPointF &p, const QPicture &picture);
  364. void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
  365. void setLayoutDirection(Qt::LayoutDirection direction);
  366. Qt::LayoutDirection layoutDirection() const;
  367. void drawText(const QPointF &p, const QString &s);
  368. void drawText(const QRectF &rectangle, int flags, const QString &text, QRectF *boundingRect /Out/ = 0);
  369. void drawText(const QRect &rectangle, int flags, const QString &text, QRect *boundingRect /Out/ = 0);
  370. void drawText(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption());
  371. QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
  372. QRect boundingRect(const QRect &rect, int flags, const QString &text);
  373. QRectF boundingRect(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption());
  374. void fillRect(const QRectF &, const QBrush &);
  375. void fillRect(const QRect &, const QBrush &);
  376. void eraseRect(const QRectF &);
  377. void setRenderHint(QPainter::RenderHint hint, bool on = true);
  378. QPainter::RenderHints renderHints() const;
  379. void setRenderHints(QPainter::RenderHints hints, bool on = true);
  380. QPaintEngine *paintEngine() const;
  381. void drawLine(const QLineF &l);
  382. void drawLine(const QLine &line);
  383. void drawLine(int x1, int y1, int x2, int y2);
  384. void drawLine(const QPoint &p1, const QPoint &p2);
  385. void drawLine(const QPointF &p1, const QPointF &p2);
  386. void drawRect(const QRectF &rect);
  387. void drawRect(int x, int y, int w, int h);
  388. void drawRect(const QRect &r);
  389. void drawPoint(const QPointF &p);
  390. void drawPoint(int x, int y);
  391. void drawPoint(const QPoint &p);
  392. void drawEllipse(int x, int y, int w, int h);
  393. void drawArc(const QRect &r, int a, int alen);
  394. void drawArc(int x, int y, int w, int h, int a, int alen);
  395. void drawPie(const QRect &rect, int a, int alen);
  396. void drawPie(int x, int y, int w, int h, int a, int alen);
  397. void drawChord(const QRect &rect, int a, int alen);
  398. void drawChord(int x, int y, int w, int h, int a, int alen);
  399. void setClipRect(int x, int y, int width, int height, Qt::ClipOperation operation = Qt::ReplaceClip);
  400. void setClipRect(const QRect &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip);
  401. void eraseRect(const QRect &rect);
  402. void eraseRect(int x, int y, int w, int h);
  403. void fillRect(int x, int y, int w, int h, const QBrush &b);
  404. void setBrushOrigin(int x, int y);
  405. void setBrushOrigin(const QPoint &p);
  406. void drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap, const QPoint &pos = QPoint());
  407. void drawTiledPixmap(int x, int y, int width, int height, const QPixmap &pixmap, int sx = 0, int sy = 0);
  408. void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
  409. void drawPixmap(const QPointF &p, const QPixmap &pm);
  410. void drawPixmap(const QPoint &p, const QPixmap &pm);
  411. void drawPixmap(const QRect &r, const QPixmap &pm);
  412. void drawPixmap(int x, int y, const QPixmap &pm);
  413. void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
  414. void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy, int sw, int sh);
  415. void drawPixmap(int x, int y, const QPixmap &pm, int sx, int sy, int sw, int sh);
  416. void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
  417. void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
  418. void drawImage(const QRectF &r, const QImage &image);
  419. void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor);
  420. void drawImage(const QRect &r, const QImage &image);
  421. void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor);
  422. void drawImage(const QPointF &p, const QImage &image);
  423. void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor);
  424. void drawImage(const QPoint &p, const QImage &image);
  425. void drawImage(const QPoint &p, const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags = Qt::AutoColor);
  426. void drawImage(int x, int y, const QImage &image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, Qt::ImageConversionFlags flags = Qt::AutoColor);
  427. void drawText(const QPoint &p, const QString &s);
  428. void drawText(int x, int y, int width, int height, int flags, const QString &text, QRect *boundingRect /Out/ = 0);
  429. void drawText(int x, int y, const QString &s);
  430. QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
  431. qreal opacity() const;
  432. void setOpacity(qreal opacity);
  433. void translate(qreal dx, qreal dy);
  434. void translate(const QPoint &offset);
  435. void setViewport(int x, int y, int w, int h);
  436. void setWindow(int x, int y, int w, int h);
  437. bool worldMatrixEnabled() const;
  438. void setWorldMatrixEnabled(bool enabled);
  439. void drawPicture(int x, int y, const QPicture &p);
  440. void drawPicture(const QPoint &pt, const QPicture &p);
  441. void setTransform(const QTransform &transform, bool combine = false);
  442. const QTransform &transform() const;
  443. const QTransform &deviceTransform() const;
  444. void resetTransform();
  445. void setWorldTransform(const QTransform &matrix, bool combine = false);
  446. const QTransform &worldTransform() const;
  447. QTransform combinedTransform() const;
  448. bool testRenderHint(QPainter::RenderHint hint) const;
  449. void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
  450. void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
  451. void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
  452. void drawEllipse(const QPointF &center, qreal rx, qreal ry);
  453. void drawEllipse(const QPoint &center, int rx, int ry);
  454. void fillRect(const QRectF &, const QColor &color);
  455. void fillRect(const QRect &, const QColor &color);
  456. void fillRect(int x, int y, int w, int h, const QColor &b);
  457. void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
  458. void fillRect(const QRect &r, Qt::GlobalColor c);
  459. void fillRect(const QRectF &r, Qt::GlobalColor c);
  460. void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
  461. void fillRect(const QRect &r, Qt::BrushStyle style);
  462. void fillRect(const QRectF &r, Qt::BrushStyle style);
  463. void beginNativePainting();
  464. void endNativePainting();
  465. class PixmapFragment
  466. {
  467. %TypeHeaderCode
  468. #include <qpainter.h>
  469. %End
  470. public:
  471. qreal x;
  472. qreal y;
  473. qreal sourceLeft;
  474. qreal sourceTop;
  475. qreal width;
  476. qreal height;
  477. qreal scaleX;
  478. qreal scaleY;
  479. qreal rotation;
  480. qreal opacity;
  481. static QPainter::PixmapFragment create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1) /Factory/;
  482. };
  483. enum PixmapFragmentHint /BaseType=Flag/
  484. {
  485. OpaqueHint,
  486. };
  487. typedef QFlags<QPainter::PixmapFragmentHint> PixmapFragmentHints;
  488. void drawPixmapFragments(const QPainter::PixmapFragment *fragments /Array/, int fragmentCount /ArraySize/, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints = QPainter::PixmapFragmentHints());
  489. void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
  490. void drawStaticText(const QPoint &p, const QStaticText &staticText);
  491. void drawStaticText(int x, int y, const QStaticText &staticText);
  492. QRectF clipBoundingRect() const;
  493. %If (PyQt_RawFont)
  494. void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
  495. %End
  496. void fillRect(int x, int y, int w, int h, QGradient::Preset preset);
  497. void fillRect(const QRect &r, QGradient::Preset preset);
  498. void fillRect(const QRectF &r, QGradient::Preset preset);
  499. %If (Qt_6_11_0 -)
  500. QPointF brushOriginF() const;
  501. %End
  502. private:
  503. QPainter(const QPainter &);
  504. };