| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557 |
- // qpainter.sip generated by MetaSIP
- //
- // This file is part of the QtGui Python extension module.
- //
- // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
- //
- // This file is part of PyQt6.
- //
- // This file may be used under the terms of the GNU General Public License
- // version 3.0 as published by the Free Software Foundation and appearing in
- // the file LICENSE included in the packaging of this file. Please review the
- // following information to ensure the GNU General Public License version 3.0
- // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
- //
- // If you do not wish to use this file under the terms of the GPL version 3.0
- // then you may purchase a commercial license. For more information contact
- // info@riverbankcomputing.com.
- //
- // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
- // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- class QPainter
- {
- %TypeHeaderCode
- #include <qpainter.h>
- %End
- %TypeCode
- // Return an array on the heap of class instances extracted from a set of
- // Python arguments.
- template<class TYPE>
- static TYPE *qtgui_inst_array(const TYPE *first, PyObject *t, sipTypeDef *td)
- {
- TYPE *arr = new TYPE[1 + PyTuple_Size(t)];
- arr[0] = *first;
- for (Py_ssize_t i = 0; i < PyTuple_Size(t); ++i)
- {
- int iserr = 0, state;
- TYPE *itm;
- itm = reinterpret_cast<TYPE *>(sipForceConvertToType(PyTuple_GetItem(t, i), td, 0, SIP_NOT_NONE, &state, &iserr));
- if (iserr)
- {
- sipReleaseType(itm, td, state);
- PyErr_Format(PyExc_TypeError, "each argument must be an instance of %s", sipPyTypeName(sipTypeAsPyTypeObject(td)));
- delete[] arr;
- return 0;
- }
- arr[1 + i] = *itm;
- sipReleaseType(itm, td, state);
- }
- return arr;
- }
- %End
- public:
- enum RenderHint /BaseType=Flag/
- {
- Antialiasing,
- TextAntialiasing,
- SmoothPixmapTransform,
- LosslessImageRendering,
- %If (Qt_6_1_0 -)
- VerticalSubpixelPositioning,
- %End
- %If (Qt_6_4_0 -)
- NonCosmeticBrushPatterns,
- %End
- };
- typedef QFlags<QPainter::RenderHint> RenderHints;
- QPainter();
- explicit QPainter(QPaintDevice *);
- ~QPainter();
- SIP_PYOBJECT __enter__();
- %MethodCode
- // Check a device was passed.
- if (sipCpp->isActive())
- {
- // Just return a reference to self.
- sipRes = sipSelf;
- Py_INCREF(sipRes);
- }
- else
- {
- PyErr_SetString(PyExc_ValueError, "QPainter must be created with a device");
- sipRes = 0;
- }
- %End
- void __exit__(SIP_PYOBJECT type, SIP_PYOBJECT value, SIP_PYOBJECT traceback);
- %MethodCode
- sipCpp->end();
- %End
- QPaintDevice *device() const;
- bool begin(QPaintDevice *);
- bool end();
- bool isActive() const;
- enum CompositionMode
- {
- CompositionMode_SourceOver,
- CompositionMode_DestinationOver,
- CompositionMode_Clear,
- CompositionMode_Source,
- CompositionMode_Destination,
- CompositionMode_SourceIn,
- CompositionMode_DestinationIn,
- CompositionMode_SourceOut,
- CompositionMode_DestinationOut,
- CompositionMode_SourceAtop,
- CompositionMode_DestinationAtop,
- CompositionMode_Xor,
- CompositionMode_Plus,
- CompositionMode_Multiply,
- CompositionMode_Screen,
- CompositionMode_Overlay,
- CompositionMode_Darken,
- CompositionMode_Lighten,
- CompositionMode_ColorDodge,
- CompositionMode_ColorBurn,
- CompositionMode_HardLight,
- CompositionMode_SoftLight,
- CompositionMode_Difference,
- CompositionMode_Exclusion,
- RasterOp_SourceOrDestination,
- RasterOp_SourceAndDestination,
- RasterOp_SourceXorDestination,
- RasterOp_NotSourceAndNotDestination,
- RasterOp_NotSourceOrNotDestination,
- RasterOp_NotSourceXorDestination,
- RasterOp_NotSource,
- RasterOp_NotSourceAndDestination,
- RasterOp_SourceAndNotDestination,
- RasterOp_NotSourceOrDestination,
- RasterOp_SourceOrNotDestination,
- RasterOp_ClearDestination,
- RasterOp_SetDestination,
- RasterOp_NotDestination,
- };
- void setCompositionMode(QPainter::CompositionMode mode);
- QPainter::CompositionMode compositionMode() const;
- const QFont &font() const;
- void setFont(const QFont &f);
- QFontMetrics fontMetrics() const;
- QFontInfo fontInfo() const;
- void setPen(const QColor &color);
- void setPen(const QPen &pen);
- void setPen(Qt::PenStyle style);
- const QPen &pen() const;
- void setBrush(const QBrush &brush);
- void setBrush(Qt::BrushStyle style);
- const QBrush &brush() const;
- void setBackgroundMode(Qt::BGMode mode);
- Qt::BGMode backgroundMode() const;
- QPoint brushOrigin() const;
- void setBrushOrigin(const QPointF &);
- void setBackground(const QBrush &bg);
- const QBrush &background() const;
- QRegion clipRegion() const;
- QPainterPath clipPath() const;
- void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip);
- void setClipRegion(const QRegion ®ion, Qt::ClipOperation operation = Qt::ReplaceClip);
- void setClipPath(const QPainterPath &path, Qt::ClipOperation operation = Qt::ReplaceClip);
- void setClipping(bool enable);
- bool hasClipping() const;
- void save();
- void restore();
- void scale(qreal sx, qreal sy);
- void shear(qreal sh, qreal sv);
- void rotate(qreal a);
- void translate(const QPointF &offset);
- QRect window() const;
- void setWindow(const QRect &window);
- QRect viewport() const;
- void setViewport(const QRect &viewport);
- void setViewTransformEnabled(bool enable);
- bool viewTransformEnabled() const;
- void strokePath(const QPainterPath &path, const QPen &pen);
- void fillPath(const QPainterPath &path, const QBrush &brush);
- void drawPath(const QPainterPath &path);
- void drawPoints(const QPolygonF &points);
- void drawPoints(const QPolygon &points);
- void drawPoints(const QPointF *points /Array/, int pointCount /ArraySize/);
- void drawPoints(const QPointF *point, ... /TypeHint="QPointF"/);
- %MethodCode
- QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
-
- if (points)
- {
- sipCpp->drawPoints(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawPoints(const QPoint *points /Array/, int pointCount /ArraySize/);
- void drawPoints(const QPoint *point, ... /TypeHint="QPoint"/);
- %MethodCode
- QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
-
- if (points)
- {
- sipCpp->drawPoints(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawLines(const QLineF *lines /Array/, int lineCount /ArraySize/);
- void drawLines(const QLineF *line, ... /TypeHint="QLineF"/);
- %MethodCode
- QLineF *lines = qtgui_inst_array<QLineF>(a0, a1, sipType_QLineF);
-
- if (lines)
- {
- sipCpp->drawLines(lines, 1 + PyTuple_Size(a1));
- delete[] lines;
- }
- else
- sipIsErr = 1;
- %End
- void drawLines(const QPointF *pointPairs /Array/, int lineCount /ArraySize/);
- %MethodCode
- sipCpp->drawLines(a0, a1 / 2);
- %End
- void drawLines(const QPointF *pointPair, ... /TypeHint="QPointF"/);
- %MethodCode
- QPointF *pairs = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
-
- if (pairs)
- {
- sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2);
- delete[] pairs;
- }
- else
- sipIsErr = 1;
- %End
- void drawLines(const QLine *lines /Array/, int lineCount /ArraySize/);
- void drawLines(const QLine *line, ... /TypeHint="QLine"/);
- %MethodCode
- QLine *lines = qtgui_inst_array<QLine>(a0, a1, sipType_QLine);
-
- if (lines)
- {
- sipCpp->drawLines(lines, 1 + PyTuple_Size(a1));
- delete[] lines;
- }
- else
- sipIsErr = 1;
- %End
- void drawLines(const QPoint *pointPairs /Array/, int lineCount /ArraySize/);
- %MethodCode
- sipCpp->drawLines(a0, a1 / 2);
- %End
- void drawLines(const QPoint *pointPair, ... /TypeHint="QPoint"/);
- %MethodCode
- QPoint *pairs = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
-
- if (pairs)
- {
- sipCpp->drawLines(pairs, (1 + PyTuple_Size(a1)) / 2);
- delete[] pairs;
- }
- else
- sipIsErr = 1;
- %End
- void drawRects(const QRectF *rects /Array/, int rectCount /ArraySize/);
- void drawRects(const QRectF *rect, ... /TypeHint="QRectF"/);
- %MethodCode
- QRectF *rects = qtgui_inst_array<QRectF>(a0, a1, sipType_QRectF);
-
- if (rects)
- {
- sipCpp->drawRects(rects, 1 + PyTuple_Size(a1));
- delete[] rects;
- }
- else
- sipIsErr = 1;
- %End
- void drawRects(const QRect *rects /Array/, int rectCount /ArraySize/);
- void drawRects(const QRect *rect, ... /TypeHint="QRect"/);
- %MethodCode
- QRect *rects = qtgui_inst_array<QRect>(a0, a1, sipType_QRect);
-
- if (rects)
- {
- sipCpp->drawRects(rects, 1 + PyTuple_Size(a1));
- delete[] rects;
- }
- else
- sipIsErr = 1;
- %End
- void drawEllipse(const QRectF &r);
- void drawEllipse(const QRect &r);
- void drawPolyline(const QPolygonF &polyline);
- void drawPolyline(const QPolygon &polyline);
- void drawPolyline(const QPointF *points /Array/, int pointCount /ArraySize/);
- void drawPolyline(const QPointF *point, ... /TypeHint="QPointF"/);
- %MethodCode
- QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
-
- if (points)
- {
- sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawPolyline(const QPoint *points /Array/, int pointCount /ArraySize/);
- void drawPolyline(const QPoint *point, ... /TypeHint="QPoint"/);
- %MethodCode
- QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
-
- if (points)
- {
- sipCpp->drawPolyline(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawPolygon(const QPolygonF &points, Qt::FillRule fillRule = Qt::OddEvenFill);
- void drawPolygon(const QPolygon &points, Qt::FillRule fillRule = Qt::OddEvenFill);
- void drawPolygon(const QPointF *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill);
- void drawPolygon(const QPointF *point, ... /TypeHint="QPointF"/);
- %MethodCode
- QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
-
- if (points)
- {
- sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawPolygon(const QPoint *points /Array/, int pointCount /ArraySize/, Qt::FillRule fillRule = Qt::OddEvenFill);
- void drawPolygon(const QPoint *point, ... /TypeHint="QPoint"/);
- %MethodCode
- QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
-
- if (points)
- {
- sipCpp->drawPolygon(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawConvexPolygon(const QPolygonF &poly);
- void drawConvexPolygon(const QPolygon &poly);
- void drawConvexPolygon(const QPointF *points /Array/, int pointCount /ArraySize/);
- void drawConvexPolygon(const QPointF *point, ... /TypeHint="QPointF"/);
- %MethodCode
- QPointF *points = qtgui_inst_array<QPointF>(a0, a1, sipType_QPointF);
-
- if (points)
- {
- sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawConvexPolygon(const QPoint *points /Array/, int pointCount /ArraySize/);
- void drawConvexPolygon(const QPoint *point, ... /TypeHint="QPoint"/);
- %MethodCode
- QPoint *points = qtgui_inst_array<QPoint>(a0, a1, sipType_QPoint);
-
- if (points)
- {
- sipCpp->drawConvexPolygon(points, 1 + PyTuple_Size(a1));
- delete[] points;
- }
- else
- sipIsErr = 1;
- %End
- void drawArc(const QRectF &rect, int a, int alen);
- void drawPie(const QRectF &rect, int a, int alen);
- void drawChord(const QRectF &rect, int a, int alen);
- void drawTiledPixmap(const QRectF &rectangle, const QPixmap &pixmap, const QPointF &pos = QPointF());
- void drawPicture(const QPointF &p, const QPicture &picture);
- void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect);
- void setLayoutDirection(Qt::LayoutDirection direction);
- Qt::LayoutDirection layoutDirection() const;
- void drawText(const QPointF &p, const QString &s);
- void drawText(const QRectF &rectangle, int flags, const QString &text, QRectF *boundingRect /Out/ = 0);
- void drawText(const QRect &rectangle, int flags, const QString &text, QRect *boundingRect /Out/ = 0);
- void drawText(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption());
- QRectF boundingRect(const QRectF &rect, int flags, const QString &text);
- QRect boundingRect(const QRect &rect, int flags, const QString &text);
- QRectF boundingRect(const QRectF &rectangle, const QString &text, const QTextOption &option = QTextOption());
- void fillRect(const QRectF &, const QBrush &);
- void fillRect(const QRect &, const QBrush &);
- void eraseRect(const QRectF &);
- void setRenderHint(QPainter::RenderHint hint, bool on = true);
- QPainter::RenderHints renderHints() const;
- void setRenderHints(QPainter::RenderHints hints, bool on = true);
- QPaintEngine *paintEngine() const;
- void drawLine(const QLineF &l);
- void drawLine(const QLine &line);
- void drawLine(int x1, int y1, int x2, int y2);
- void drawLine(const QPoint &p1, const QPoint &p2);
- void drawLine(const QPointF &p1, const QPointF &p2);
- void drawRect(const QRectF &rect);
- void drawRect(int x, int y, int w, int h);
- void drawRect(const QRect &r);
- void drawPoint(const QPointF &p);
- void drawPoint(int x, int y);
- void drawPoint(const QPoint &p);
- void drawEllipse(int x, int y, int w, int h);
- void drawArc(const QRect &r, int a, int alen);
- void drawArc(int x, int y, int w, int h, int a, int alen);
- void drawPie(const QRect &rect, int a, int alen);
- void drawPie(int x, int y, int w, int h, int a, int alen);
- void drawChord(const QRect &rect, int a, int alen);
- void drawChord(int x, int y, int w, int h, int a, int alen);
- void setClipRect(int x, int y, int width, int height, Qt::ClipOperation operation = Qt::ReplaceClip);
- void setClipRect(const QRect &rectangle, Qt::ClipOperation operation = Qt::ReplaceClip);
- void eraseRect(const QRect &rect);
- void eraseRect(int x, int y, int w, int h);
- void fillRect(int x, int y, int w, int h, const QBrush &b);
- void setBrushOrigin(int x, int y);
- void setBrushOrigin(const QPoint &p);
- void drawTiledPixmap(const QRect &rectangle, const QPixmap &pixmap, const QPoint &pos = QPoint());
- void drawTiledPixmap(int x, int y, int width, int height, const QPixmap &pixmap, int sx = 0, int sy = 0);
- void drawPixmap(const QRect &targetRect, const QPixmap &pixmap, const QRect &sourceRect);
- void drawPixmap(const QPointF &p, const QPixmap &pm);
- void drawPixmap(const QPoint &p, const QPixmap &pm);
- void drawPixmap(const QRect &r, const QPixmap &pm);
- void drawPixmap(int x, int y, const QPixmap &pm);
- void drawPixmap(int x, int y, int w, int h, const QPixmap &pm);
- void drawPixmap(int x, int y, int w, int h, const QPixmap &pm, int sx, int sy, int sw, int sh);
- void drawPixmap(int x, int y, const QPixmap &pm, int sx, int sy, int sw, int sh);
- void drawPixmap(const QPointF &p, const QPixmap &pm, const QRectF &sr);
- void drawPixmap(const QPoint &p, const QPixmap &pm, const QRect &sr);
- void drawImage(const QRectF &r, const QImage &image);
- void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor);
- void drawImage(const QRect &r, const QImage &image);
- void drawImage(const QRect &targetRect, const QImage &image, const QRect &sourceRect, Qt::ImageConversionFlags flags = Qt::AutoColor);
- void drawImage(const QPointF &p, const QImage &image);
- void drawImage(const QPointF &p, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor);
- void drawImage(const QPoint &p, const QImage &image);
- void drawImage(const QPoint &p, const QImage &image, const QRect &sr, Qt::ImageConversionFlags flags = Qt::AutoColor);
- 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);
- void drawText(const QPoint &p, const QString &s);
- void drawText(int x, int y, int width, int height, int flags, const QString &text, QRect *boundingRect /Out/ = 0);
- void drawText(int x, int y, const QString &s);
- QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text);
- qreal opacity() const;
- void setOpacity(qreal opacity);
- void translate(qreal dx, qreal dy);
- void translate(const QPoint &offset);
- void setViewport(int x, int y, int w, int h);
- void setWindow(int x, int y, int w, int h);
- bool worldMatrixEnabled() const;
- void setWorldMatrixEnabled(bool enabled);
- void drawPicture(int x, int y, const QPicture &p);
- void drawPicture(const QPoint &pt, const QPicture &p);
- void setTransform(const QTransform &transform, bool combine = false);
- const QTransform &transform() const;
- const QTransform &deviceTransform() const;
- void resetTransform();
- void setWorldTransform(const QTransform &matrix, bool combine = false);
- const QTransform &worldTransform() const;
- QTransform combinedTransform() const;
- bool testRenderHint(QPainter::RenderHint hint) const;
- void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
- void drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
- void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize);
- void drawEllipse(const QPointF ¢er, qreal rx, qreal ry);
- void drawEllipse(const QPoint ¢er, int rx, int ry);
- void fillRect(const QRectF &, const QColor &color);
- void fillRect(const QRect &, const QColor &color);
- void fillRect(int x, int y, int w, int h, const QColor &b);
- void fillRect(int x, int y, int w, int h, Qt::GlobalColor c);
- void fillRect(const QRect &r, Qt::GlobalColor c);
- void fillRect(const QRectF &r, Qt::GlobalColor c);
- void fillRect(int x, int y, int w, int h, Qt::BrushStyle style);
- void fillRect(const QRect &r, Qt::BrushStyle style);
- void fillRect(const QRectF &r, Qt::BrushStyle style);
- void beginNativePainting();
- void endNativePainting();
- class PixmapFragment
- {
- %TypeHeaderCode
- #include <qpainter.h>
- %End
- public:
- qreal x;
- qreal y;
- qreal sourceLeft;
- qreal sourceTop;
- qreal width;
- qreal height;
- qreal scaleX;
- qreal scaleY;
- qreal rotation;
- qreal opacity;
- static QPainter::PixmapFragment create(const QPointF &pos, const QRectF &sourceRect, qreal scaleX = 1, qreal scaleY = 1, qreal rotation = 0, qreal opacity = 1) /Factory/;
- };
- enum PixmapFragmentHint /BaseType=Flag/
- {
- OpaqueHint,
- };
- typedef QFlags<QPainter::PixmapFragmentHint> PixmapFragmentHints;
- void drawPixmapFragments(const QPainter::PixmapFragment *fragments /Array/, int fragmentCount /ArraySize/, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints = QPainter::PixmapFragmentHints());
- void drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText);
- void drawStaticText(const QPoint &p, const QStaticText &staticText);
- void drawStaticText(int x, int y, const QStaticText &staticText);
- QRectF clipBoundingRect() const;
- %If (PyQt_RawFont)
- void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun);
- %End
- void fillRect(int x, int y, int w, int h, QGradient::Preset preset);
- void fillRect(const QRect &r, QGradient::Preset preset);
- void fillRect(const QRectF &r, QGradient::Preset preset);
- %If (Qt_6_11_0 -)
- QPointF brushOriginF() const;
- %End
- private:
- QPainter(const QPainter &);
- };
|