1 /****************************************************************************
2 **
3 ** DQt - D bindings for the Qt Toolkit
4 **
5 ** GNU Lesser General Public License Usage
6 ** This file may be used under the terms of the GNU Lesser
7 ** General Public License version 3 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
9 ** packaging of this file. Please review the following information to
10 ** ensure the GNU Lesser General Public License version 3 requirements
11 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
12 **
13 ****************************************************************************/
14 module qt.gui.imagewriter;
15 extern(C++):
16 
17 import qt.config;
18 import qt.core.bytearray;
19 import qt.core.coreapplication;
20 import qt.core.iodevice;
21 import qt.core.list;
22 import qt.core.string;
23 import qt.gui.image;
24 import qt.gui.imageiohandler;
25 import qt.helpers;
26 
27 /+ class QIODevice;
28 class QImage; +/
29 
30 extern(C++, class) struct QImageWriterPrivate;
31 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QImageWriter
32 {
33     /+ Q_DECLARE_TR_FUNCTIONS(QImageWriter) +/
34 public:pragma(inline, true) static QString tr(const(char)* sourceText, const(char)* disambiguation=null, int n=-1){return QCoreApplication.translate("QImageWriter",sourceText,disambiguation,n);} mixin(QT_DECLARE_DEPRECATED_TR_FUNCTIONS(q{QImageWriter}));private:public:
35     enum ImageWriterError {
36         UnknownError,
37         DeviceError,
38         UnsupportedFormatError,
39         InvalidImageError
40     }
41 
42     @disable this();
43     pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this))))
44     ref typeof(this) rawConstructor();
45     static typeof(this) create()
46     {
47         typeof(this) r = typeof(this).init;
48         r.rawConstructor();
49         return r;
50     }
51 
52     /+ explicit +/this(QIODevice device, ref const(QByteArray) format);
53     /+ explicit +/this(ref const(QString) fileName, ref const(QByteArray) format = globalInitVar!QByteArray);
54     ~this();
55 
56     void setFormat(ref const(QByteArray) format);
57     QByteArray format() const;
58 
59     void setDevice(QIODevice device);
60     QIODevice device() const;
61 
62     void setFileName(ref const(QString) fileName);
63     QString fileName() const;
64 
65     void setQuality(int quality);
66     int quality() const;
67 
68     void setCompression(int compression);
69     int compression() const;
70 
71 /+ #if QT_DEPRECATED_SINCE(5, 15) +/
72     /+ QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") +/
73         void setGamma(float gamma);
74     /+ QT_DEPRECATED_VERSION_X_5_15("Use QColorSpace instead") +/
75         float gamma() const;
76 /+ #endif +/
77 
78     void setSubType(ref const(QByteArray) type);
79     QByteArray subType() const;
80     QList!(QByteArray) supportedSubTypes() const;
81 
82     void setOptimizedWrite(bool optimize);
83     bool optimizedWrite() const;
84 
85     void setProgressiveScanWrite(bool progressive);
86     bool progressiveScanWrite() const;
87 
88     QImageIOHandler.Transformations transformation() const;
89     void setTransformation(QImageIOHandler.Transformations orientation);
90 
91 /+ #if QT_DEPRECATED_SINCE(5, 13) +/
92     /+ QT_DEPRECATED_X("Use QImageWriter::setText() instead") +/
93         void setDescription(ref const(QString) description);
94     /+ QT_DEPRECATED_X("Use QImageReader::text() instead") +/
95         QString description() const;
96 /+ #endif +/
97 
98     void setText(ref const(QString) key, ref const(QString) text);
99 
100     bool canWrite() const;
101     bool write(ref const(QImage) image);
102 
103     ImageWriterError error() const;
104     QString errorString() const;
105 
106     bool supportsOption(QImageIOHandler.ImageOption option) const;
107 
108     static QList!(QByteArray) supportedImageFormats();
109     static QList!(QByteArray) supportedMimeTypes();
110     static QList!(QByteArray) imageFormatsForMimeType(ref const(QByteArray) mimeType);
111 
112 private:
113     /+ Q_DISABLE_COPY(QImageWriter) +/
114 @disable this(this);
115 /+this(ref const(QImageWriter));+//+ref QImageWriter operator =(ref const(QImageWriter));+/    QImageWriterPrivate* d;
116 }
117