qpainterpath.sip 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. // qpainterpath.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 QPainterPath
  22. {
  23. %TypeHeaderCode
  24. #include <qpainterpath.h>
  25. %End
  26. public:
  27. enum ElementType
  28. {
  29. MoveToElement,
  30. LineToElement,
  31. CurveToElement,
  32. CurveToDataElement,
  33. };
  34. class Element
  35. {
  36. %TypeHeaderCode
  37. #include <qpainterpath.h>
  38. %End
  39. public:
  40. qreal x;
  41. qreal y;
  42. QPainterPath::ElementType type;
  43. bool isMoveTo() const;
  44. bool isLineTo() const;
  45. bool isCurveTo() const;
  46. bool operator==(const QPainterPath::Element &e) const;
  47. bool operator!=(const QPainterPath::Element &e) const;
  48. operator QPointF() const;
  49. };
  50. QPainterPath();
  51. explicit QPainterPath(const QPointF &startPoint);
  52. QPainterPath(const QPainterPath &other);
  53. ~QPainterPath();
  54. void closeSubpath();
  55. void moveTo(const QPointF &p);
  56. void lineTo(const QPointF &p);
  57. void arcTo(const QRectF &rect, qreal startAngle, qreal arcLength);
  58. void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt);
  59. void quadTo(const QPointF &ctrlPt, const QPointF &endPt);
  60. QPointF currentPosition() const;
  61. void addRect(const QRectF &rect);
  62. void addEllipse(const QRectF &rect);
  63. void addPolygon(const QPolygonF &polygon);
  64. void addText(const QPointF &point, const QFont &f, const QString &text);
  65. void addPath(const QPainterPath &path);
  66. void addRegion(const QRegion &region);
  67. void connectPath(const QPainterPath &path);
  68. bool contains(const QPointF &pt) const;
  69. bool contains(const QRectF &rect) const;
  70. bool intersects(const QRectF &rect) const;
  71. QRectF boundingRect() const;
  72. QRectF controlPointRect() const;
  73. Qt::FillRule fillRule() const;
  74. void setFillRule(Qt::FillRule fillRule);
  75. QPainterPath toReversed() const;
  76. QList<QPolygonF> toSubpathPolygons(const QTransform &matrix = QTransform()) const;
  77. QList<QPolygonF> toFillPolygons(const QTransform &matrix = QTransform()) const;
  78. QPolygonF toFillPolygon(const QTransform &matrix = QTransform()) const;
  79. bool operator==(const QPainterPath &other) const;
  80. bool operator!=(const QPainterPath &other) const;
  81. void moveTo(qreal x, qreal y);
  82. void arcMoveTo(const QRectF &rect, qreal angle);
  83. void arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle);
  84. void arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght);
  85. void lineTo(qreal x, qreal y);
  86. void cubicTo(qreal ctrlPt1x, qreal ctrlPt1y, qreal ctrlPt2x, qreal ctrlPt2y, qreal endPtx, qreal endPty);
  87. void quadTo(qreal ctrlPtx, qreal ctrlPty, qreal endPtx, qreal endPty);
  88. void addEllipse(qreal x, qreal y, qreal w, qreal h);
  89. void addRect(qreal x, qreal y, qreal w, qreal h);
  90. void addText(qreal x, qreal y, const QFont &f, const QString &text);
  91. bool isEmpty() const;
  92. int elementCount() const;
  93. QPainterPath::Element elementAt(int i) const;
  94. void setElementPositionAt(int i, qreal x, qreal y);
  95. qreal length() const;
  96. qreal percentAtLength(qreal t) const;
  97. QPointF pointAtPercent(qreal t) const;
  98. qreal angleAtPercent(qreal t) const;
  99. qreal slopeAtPercent(qreal t) const;
  100. bool intersects(const QPainterPath &p) const;
  101. bool contains(const QPainterPath &p) const;
  102. QPainterPath united(const QPainterPath &r) const;
  103. QPainterPath intersected(const QPainterPath &r) const;
  104. QPainterPath subtracted(const QPainterPath &r) const;
  105. void addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
  106. void addRoundedRect(qreal x, qreal y, qreal w, qreal h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
  107. void addEllipse(const QPointF &center, qreal rx, qreal ry);
  108. QPainterPath simplified() const;
  109. QPainterPath operator&(const QPainterPath &other) const;
  110. QPainterPath operator|(const QPainterPath &other) const;
  111. QPainterPath operator+(const QPainterPath &other) const;
  112. QPainterPath operator-(const QPainterPath &other) const;
  113. QPainterPath &operator&=(const QPainterPath &other);
  114. QPainterPath &operator|=(const QPainterPath &other);
  115. QPainterPath &operator+=(const QPainterPath &other);
  116. QPainterPath &operator-=(const QPainterPath &other);
  117. void translate(qreal dx, qreal dy);
  118. QPainterPath translated(qreal dx, qreal dy) const;
  119. void translate(const QPointF &offset);
  120. QPainterPath translated(const QPointF &offset) const;
  121. void swap(QPainterPath &other /Constrained/);
  122. void clear();
  123. void reserve(int size);
  124. int capacity() const;
  125. %If (Qt_6_10_0 -)
  126. bool isCachingEnabled() const;
  127. %End
  128. %If (Qt_6_10_0 -)
  129. void setCachingEnabled(bool enabled);
  130. %End
  131. %If (Qt_6_10_0 -)
  132. QPainterPath trimmed(qreal fromFraction, qreal toFraction, qreal offset = 0) const;
  133. %End
  134. };
  135. QDataStream &operator<<(QDataStream &, const QPainterPath &) /ReleaseGIL/;
  136. QDataStream &operator>>(QDataStream &, QPainterPath & /Constrained/) /ReleaseGIL/;
  137. class QPainterPathStroker
  138. {
  139. %TypeHeaderCode
  140. #include <qpainterpath.h>
  141. %End
  142. public:
  143. QPainterPathStroker();
  144. explicit QPainterPathStroker(const QPen &pen);
  145. ~QPainterPathStroker();
  146. void setWidth(qreal width);
  147. qreal width() const;
  148. void setCapStyle(Qt::PenCapStyle style);
  149. Qt::PenCapStyle capStyle() const;
  150. void setJoinStyle(Qt::PenJoinStyle style);
  151. Qt::PenJoinStyle joinStyle() const;
  152. void setMiterLimit(qreal length);
  153. qreal miterLimit() const;
  154. void setCurveThreshold(qreal threshold);
  155. qreal curveThreshold() const;
  156. void setDashPattern(Qt::PenStyle);
  157. void setDashPattern(const QList<qreal> &dashPattern);
  158. QList<qreal> dashPattern() const;
  159. QPainterPath createStroke(const QPainterPath &path) const;
  160. void setDashOffset(qreal offset);
  161. qreal dashOffset() const;
  162. private:
  163. QPainterPathStroker(const QPainterPathStroker &);
  164. };