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