1 /* 2 * DQt - D bindings for the Qt Toolkit 3 * 4 * GNU Lesser General Public License Usage 5 * This file may be used under the terms of the GNU Lesser 6 * General Public License version 3 as published by the Free Software 7 * Foundation and appearing in the file LICENSE.LGPL3 included in the 8 * packaging of this file. Please review the following information to 9 * ensure the GNU Lesser General Public License version 3 requirements 10 * will be met: https://www.gnu.org/licenses/lgpl-3.0.html. 11 */ 12 module qt.gui.imagereader; 13 extern(C++): 14 15 import qt.config; 16 import qt.core.bytearray; 17 import qt.core.coreapplication; 18 import qt.core.iodevice; 19 import qt.core.list; 20 import qt.core.rect; 21 import qt.core.size; 22 import qt.core.string; 23 import qt.core.stringlist; 24 import qt.gui.color; 25 import qt.gui.image; 26 import qt.gui.imageiohandler; 27 import qt.helpers; 28 29 30 extern(C++, class) struct QImageReaderPrivate; 31 /// Binding for C++ class [QImageReader](https://doc.qt.io/qt-6/qimagereader.html). 32 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QImageReader 33 { 34 mixin(Q_DECLARE_TR_FUNCTIONS(q{QImageReader})); 35 public: 36 enum ImageReaderError { 37 UnknownError, 38 FileNotFoundError, 39 DeviceError, 40 UnsupportedFormatError, 41 InvalidDataError 42 } 43 44 @disable this(); 45 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 46 ref typeof(this) rawConstructor(); 47 static typeof(this) create() 48 { 49 typeof(this) r = typeof(this).init; 50 r.rawConstructor(); 51 return r; 52 } 53 54 /+ explicit +/this(QIODevice device, ref const(QByteArray) format = globalInitVar!QByteArray); 55 /+ explicit +/this(ref const(QString) fileName, ref const(QByteArray) format = globalInitVar!QByteArray); 56 ~this(); 57 58 void setFormat(ref const(QByteArray) format); 59 QByteArray format() const; 60 61 void setAutoDetectImageFormat(bool enabled); 62 bool autoDetectImageFormat() const; 63 64 void setDecideFormatFromContent(bool ignored); 65 bool decideFormatFromContent() const; 66 67 void setDevice(QIODevice device); 68 QIODevice device() const; 69 70 void setFileName(ref const(QString) fileName); 71 QString fileName() const; 72 73 QSize size() const; 74 75 QImage.Format imageFormat() const; 76 77 QStringList textKeys() const; 78 QString text(ref const(QString) key) const; 79 80 void setClipRect(ref const(QRect) rect); 81 QRect clipRect() const; 82 83 void setScaledSize(ref const(QSize) size); 84 QSize scaledSize() const; 85 86 void setQuality(int quality); 87 int quality() const; 88 89 void setScaledClipRect(ref const(QRect) rect); 90 QRect scaledClipRect() const; 91 92 void setBackgroundColor(ref const(QColor) color); 93 QColor backgroundColor() const; 94 95 bool supportsAnimation() const; 96 97 QImageIOHandler.Transformations transformation() const; 98 99 void setAutoTransform(bool enabled); 100 bool autoTransform() const; 101 102 QByteArray subType() const; 103 QList!(QByteArray) supportedSubTypes() const; 104 105 bool canRead() const; 106 QImage read(); 107 bool read(QImage* image); 108 109 bool jumpToNextImage(); 110 bool jumpToImage(int imageNumber); 111 int loopCount() const; 112 int imageCount() const; 113 int nextImageDelay() const; 114 int currentImageNumber() const; 115 QRect currentImageRect() const; 116 117 ImageReaderError error() const; 118 QString errorString() const; 119 120 bool supportsOption(QImageIOHandler.ImageOption option) const; 121 122 static QByteArray imageFormat(ref const(QString) fileName); 123 static QByteArray imageFormat(QIODevice device); 124 static QList!(QByteArray) supportedImageFormats(); 125 static QList!(QByteArray) supportedMimeTypes(); 126 static QList!(QByteArray) imageFormatsForMimeType(ref const(QByteArray) mimeType); 127 static int allocationLimit(); 128 static void setAllocationLimit(int mbLimit); 129 130 private: 131 /+ Q_DISABLE_COPY(QImageReader) +/ 132 @disable this(this); 133 /+this(ref const(QImageReader));+//+ref QImageReader operator =(ref const(QImageReader));+/ QImageReaderPrivate* d; 134 mixin(CREATE_CONVENIENCE_WRAPPERS); 135 } 136