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.picture; 13 extern(C++): 14 15 import qt.config; 16 import qt.helpers; 17 version(QT_NO_PICTURE){}else 18 { 19 import qt.core.datastream; 20 import qt.core.iodevice; 21 import qt.core.rect; 22 import qt.core.shareddata; 23 import qt.core.string; 24 import qt.core.typeinfo; 25 import qt.gui.paintdevice; 26 import qt.gui.paintengine; 27 import qt.gui.painter; 28 } 29 30 version(QT_NO_PICTURE){}else 31 { 32 33 extern(C++, class) struct QPicturePrivate; 34 /// Binding for C++ class [QPicture](https://doc.qt.io/qt-6/qpicture.html). 35 @Q_RELOCATABLE_TYPE extern(C++, class) struct /+ Q_GUI_EXPORT +/ QPicture 36 { 37 private: 38 immutable void *vtbl; 39 QPaintDeviceFakeInheritance baseQPaintDeviceInterface; 40 41 public QPaintDevice paintDevice() return 42 { 43 return cast(QPaintDevice)&this; 44 } 45 46 alias PaintDeviceMetric = QPaintDevice.PaintDeviceMetric; 47 48 private: 49 /+ Q_DECLARE_PRIVATE(QPicture) +/ 50 public: 51 @disable this(); 52 /+ explicit +/this(int formatVersion/+ = -1+/); 53 @disable this(this); 54 this(ref const(QPicture) ); 55 mixin(changeWindowsMangling(q{mangleChangeFunctionType("virtual")}, q{ 56 ~this(); 57 })); 58 59 bool isNull() const; 60 61 mixin(changeWindowsMangling(q{mangleChangeFunctionType("virtual")}, q{ 62 int devType() const; 63 })); 64 uint size() const; 65 const(char)* data() const; 66 mixin(changeWindowsMangling(q{mangleChangeFunctionType("virtual")}, q{ 67 /+ virtual +/ void setData(const(char)* data, uint size); 68 })); 69 70 bool play(QPainter* p); 71 72 bool load(QIODevice dev); 73 bool load(ref const(QString) fileName); 74 bool save(QIODevice dev); 75 bool save(ref const(QString) fileName); 76 77 QRect boundingRect() const; 78 void setBoundingRect(ref const(QRect) r); 79 80 /+ref QPicture operator =(ref const(QPicture) p);+/ 81 /+ QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPicture) +/ 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 mixin(changeWindowsMangling(q{mangleChangeFunctionType("virtual")}, q{ 91 QPaintEngine paintEngine() const; 92 })); 93 94 protected: 95 this(ref QPicturePrivate data); 96 97 mixin(changeWindowsMangling(q{mangleChangeFunctionType("virtual")}, q{ 98 int metric(PaintDeviceMetric m) const; 99 })); 100 101 private: 102 bool exec(QPainter* p, ref QDataStream ds, int i); 103 104 QExplicitlySharedDataPointer!(QPicturePrivate) d_ptr; 105 /+ friend class QPicturePaintEngine; +/ 106 /+ friend class QAlphaPaintEngine; +/ 107 /+ friend class QPreviewPaintEngine; +/ 108 109 public: 110 alias DataPtr = QExplicitlySharedDataPointer!(QPicturePrivate); 111 pragma(inline, true) ref DataPtr data_ptr() return { return d_ptr; } 112 mixin(CREATE_CONVENIENCE_WRAPPERS); 113 } 114 115 /+ Q_DECLARE_SHARED(QPicture) 116 117 /***************************************************************************** 118 QPicture stream functions 119 *****************************************************************************/ 120 121 #ifndef QT_NO_DATASTREAM 122 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &); 123 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &); 124 #endif +/ 125 126 } 127 version(QT_NO_PICTURE) 128 { 129 extern(C++, class) struct QPicture; 130 } 131 132