qpixmap.sip 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // qpixmap.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 QPixmap : public QPaintDevice
  22. {
  23. %TypeHeaderCode
  24. #include <qpixmap.h>
  25. %End
  26. public:
  27. QPixmap();
  28. QPixmap(int w, int h);
  29. explicit QPixmap(const QSize &);
  30. QPixmap(const QString &fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
  31. explicit QPixmap(SIP_PYLIST xpm /TypeHint="List[str]"/) [(const char * const *xpm)];
  32. %MethodCode
  33. // The Python interface is a list of ASCII strings that make up the image.
  34. const char **str = QtGui_ListToArray(a0);
  35. if (str)
  36. {
  37. sipCpp = new sipQPixmap(str);
  38. QtGui_DeleteArray(str);
  39. }
  40. else
  41. sipIsErr = 1;
  42. %End
  43. QPixmap(const QPixmap &);
  44. QPixmap(const QVariant &variant /GetWrapper/) /NoDerived/;
  45. %MethodCode
  46. if (a0->canConvert<QPixmap>())
  47. sipCpp = new sipQPixmap(a0->value<QPixmap>());
  48. else
  49. sipError = sipBadCallableArg(0, a0Wrapper);
  50. %End
  51. virtual ~QPixmap();
  52. bool isNull() const;
  53. virtual int devType() const;
  54. int width() const;
  55. int height() const;
  56. QSize size() const;
  57. QRect rect() const;
  58. int depth() const;
  59. static int defaultDepth();
  60. void fill(const QColor &color = Qt::white);
  61. QBitmap mask() const;
  62. void setMask(const QBitmap &);
  63. bool hasAlpha() const;
  64. bool hasAlphaChannel() const;
  65. QBitmap createHeuristicMask(bool clipTight = true) const;
  66. QBitmap createMaskFromColor(const QColor &maskColor, Qt::MaskMode mode = Qt::MaskInColor) const;
  67. QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const;
  68. QPixmap scaled(const QSize &size, Qt::AspectRatioMode aspectRatioMode = Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode = Qt::FastTransformation) const;
  69. QPixmap scaledToWidth(int width, Qt::TransformationMode mode = Qt::FastTransformation) const;
  70. QPixmap scaledToHeight(int height, Qt::TransformationMode mode = Qt::FastTransformation) const;
  71. QImage toImage() const;
  72. static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
  73. static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor);
  74. bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor);
  75. bool load(const QString &fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
  76. bool loadFromData(const uchar *buf /Array/, uint len /ArraySize/, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
  77. bool loadFromData(const QByteArray &buf, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor);
  78. bool save(const QString &fileName, const char *format = 0, int quality = -1) const;
  79. bool save(QIODevice *device, const char *format = 0, int quality = -1) const;
  80. QPixmap copy(const QRect &rect = QRect()) const;
  81. void detach();
  82. bool isQBitmap() const;
  83. virtual QPaintEngine *paintEngine() const;
  84. protected:
  85. virtual int metric(QPaintDevice::PaintDeviceMetric) const;
  86. public:
  87. QPixmap copy(int ax, int ay, int awidth, int aheight) const;
  88. QPixmap transformed(const QTransform &transform, Qt::TransformationMode mode = Qt::FastTransformation) const;
  89. static QTransform trueMatrix(const QTransform &m, int w, int h);
  90. qint64 cacheKey() const;
  91. void scroll(int dx, int dy, const QRect &rect, QRegion *exposed /Out/ = 0);
  92. void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed /Out/ = 0);
  93. void swap(QPixmap &other /Constrained/);
  94. qreal devicePixelRatio() const;
  95. void setDevicePixelRatio(qreal scaleFactor);
  96. %If (Qt_6_2_0 -)
  97. QSizeF deviceIndependentSize() const;
  98. %End
  99. };
  100. QDataStream &operator<<(QDataStream &, const QPixmap &) /ReleaseGIL/;
  101. QDataStream &operator>>(QDataStream &, QPixmap & /Constrained/) /ReleaseGIL/;