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.picture; 15 extern(C++): 16 17 import qt.config; 18 import qt.helpers; 19 version(QT_NO_PICTURE){}else 20 { 21 import qt.core.bytearray; 22 import qt.core.datastream; 23 import qt.core.iodevice; 24 import qt.core.list; 25 import qt.core.rect; 26 import qt.core.shareddata; 27 import qt.core.string; 28 import qt.core.stringlist; 29 import qt.gui.paintdevice; 30 import qt.gui.paintengine; 31 import qt.gui.painter; 32 } 33 34 version(QT_NO_PICTURE){}else 35 { 36 37 extern(C++, class) struct QPicturePrivate; 38 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPicture 39 { 40 private: 41 immutable void *vtbl; 42 QPaintDeviceFakeInheritance baseQPaintDeviceInterface; 43 44 public QPaintDevice paintDevice() return 45 { 46 return cast(QPaintDevice)&this; 47 } 48 49 alias PaintDeviceMetric = QPaintDevice.PaintDeviceMetric; 50 51 private: 52 /+ Q_DECLARE_PRIVATE(QPicture) +/ 53 public: 54 @disable this(); 55 /+ explicit +/this(int formatVersion/+ = -1+/); 56 @disable this(this); 57 this(ref const(QPicture) ); 58 mixin(mangleWindows("??1QPicture@@UEAA@XZ", q{ 59 ~this(); 60 })); 61 62 bool isNull() const; 63 64 int devType() const; 65 uint size() const; 66 const(char)* data() const; 67 /+ virtual +/ void setData(const(char)* data, uint size); 68 69 bool play(QPainter* p); 70 71 bool load(QIODevice dev, const(char)* format = null); 72 bool load(ref const(QString) fileName, const(char)* format = null); 73 bool save(QIODevice dev, const(char)* format = null); 74 bool save(ref const(QString) fileName, const(char)* format = null); 75 76 QRect boundingRect() const; 77 void setBoundingRect(ref const(QRect) r); 78 79 /+ref QPicture operator =(ref const(QPicture) p);+/ 80 /+ inline QPicture &operator=(QPicture &&other) noexcept 81 { qSwap(d_ptr, other.d_ptr); return *this; } +/ 82 /+ inline void swap(QPicture &other) noexcept 83 { d_ptr.swap(other.d_ptr); } +/ 84 void detach(); 85 bool isDetached() const; 86 87 /+ friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p); +/ 88 /+ friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p); +/ 89 90 /+ #if QT_DEPRECATED_SINCE(5, 10) +/ 91 /+ QT_DEPRECATED +/ static const(char)* pictureFormat(ref const(QString) fileName); 92 /+ QT_DEPRECATED +/ static QList!(QByteArray) inputFormats(); 93 /+ QT_DEPRECATED +/ static QList!(QByteArray) outputFormats(); 94 /+ QT_DEPRECATED +/ static QStringList inputFormatList(); 95 /+ QT_DEPRECATED +/ static QStringList outputFormatList(); 96 /+ #endif +/ // QT_DEPRECATED_SINCE(5, 10) 97 98 QPaintEngine paintEngine() const; 99 100 protected: 101 this(ref QPicturePrivate data); 102 103 int metric(PaintDeviceMetric m) const; 104 105 private: 106 bool exec(QPainter* p, ref QDataStream ds, int i); 107 108 QExplicitlySharedDataPointer!(QPicturePrivate) d_ptr; 109 /+ friend class QPicturePaintEngine; +/ 110 /+ friend class QAlphaPaintEngine; +/ 111 /+ friend class QPreviewPaintEngine; +/ 112 113 public: 114 alias DataPtr = QExplicitlySharedDataPointer!(QPicturePrivate); 115 pragma(inline, true) ref DataPtr data_ptr() return { return d_ptr; } 116 } 117 118 /+ Q_DECLARE_SHARED(QPicture) +/ 119 120 121 static if(!defined!"QT_NO_PICTUREIO") 122 { 123 /+ class QIODevice; 124 class QPictureIO; +/ 125 alias picture_io_handler = ExternCPPFunc!(void function(QPictureIO* )); // picture IO handler 126 127 struct QPictureIOData; 128 129 extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPictureIO 130 { 131 public: 132 @disable this(); 133 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 134 ref typeof(this) rawConstructor(); 135 static typeof(this) create() 136 { 137 typeof(this) r = typeof(this).init; 138 r.rawConstructor(); 139 return r; 140 } 141 142 this(QIODevice ioDevice, const(char)* format); 143 this(ref const(QString) fileName, const(char)* format); 144 ~this(); 145 146 ref const(QPicture) picture() const; 147 int status() const; 148 const(char)* format() const; 149 QIODevice ioDevice() const; 150 QString fileName() const; 151 int quality() const; 152 QString description() const; 153 const(char)* parameters() const; 154 float gamma() const; 155 156 void setPicture(ref const(QPicture) ); 157 void setStatus(int); 158 void setFormat(const(char)* ); 159 void setIODevice(QIODevice ); 160 void setFileName(ref const(QString) ); 161 void setQuality(int); 162 void setDescription(ref const(QString) ); 163 void setParameters(const(char)* ); 164 void setGamma(float); 165 166 bool read(); 167 bool write(); 168 169 static QByteArray pictureFormat(ref const(QString) fileName); 170 static QByteArray pictureFormat(QIODevice ); 171 static QList!(QByteArray) inputFormats(); 172 static QList!(QByteArray) outputFormats(); 173 174 static void defineIOHandler(const(char)* format, 175 const(char)* header, 176 const(char)* flags, 177 picture_io_handler read_picture, 178 picture_io_handler write_picture); 179 180 private: 181 /+ Q_DISABLE_COPY(QPictureIO) +/ 182 @disable this(this); 183 /+this(ref const(QPictureIO));+//+ref QPictureIO operator =(ref const(QPictureIO));+/ 184 void init_(); 185 186 QPictureIOData* d; 187 } 188 189 } 190 191 192 /***************************************************************************** 193 QPicture stream functions 194 *****************************************************************************/ 195 196 /+ #ifndef QT_NO_DATASTREAM 197 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &); 198 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &); 199 #endif +/ 200 201 } 202 version(QT_NO_PICTURE) 203 { 204 extern(C++, class) struct QPicture; 205 } 206 207