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.colorspace; 15 extern(C++): 16 17 import qt.config; 18 import qt.core.bytearray; 19 import qt.core.metatype; 20 import qt.core.objectdefs; 21 import qt.core.point; 22 import qt.core.typeinfo; 23 import qt.core.variant; 24 import qt.gui.colortransform; 25 import qt.helpers; 26 27 /+ class QColorSpacePrivate; 28 class QPointF; +/ 29 30 @Q_MOVABLE_TYPE @(QMetaType.Type.QColorSpace) extern(C++, class) struct /+ Q_GUI_EXPORT +/ QColorSpace 31 { 32 mixin(Q_GADGET); 33 public: 34 enum NamedColorSpace { 35 SRgb = 1, 36 SRgbLinear, 37 AdobeRgb, 38 DisplayP3, 39 ProPhotoRgb 40 } 41 /+ Q_ENUM(NamedColorSpace) +/ 42 enum /+ class +/ Primaries { 43 Custom = 0, 44 SRgb, 45 AdobeRgb, 46 DciP3D65, 47 ProPhotoRgb 48 } 49 /+ Q_ENUM(Primaries) +/ 50 enum /+ class +/ TransferFunction { 51 Custom = 0, 52 Linear, 53 Gamma, 54 SRgb, 55 ProPhotoRgb 56 } 57 /+ Q_ENUM(TransferFunction) +/ 58 59 @disable this(); 60 pragma(mangle, defaultConstructorMangling(__traits(identifier, typeof(this)))) 61 ref typeof(this) rawConstructor(); 62 static typeof(this) create() 63 { 64 typeof(this) r = typeof(this).init; 65 r.rawConstructor(); 66 return r; 67 } 68 69 this(NamedColorSpace namedColorSpace); 70 this(Primaries primaries, TransferFunction fun, float gamma = 0.0f); 71 this(Primaries primaries, float gamma); 72 this(ref const(QPointF) whitePoint, ref const(QPointF) redPoint, 73 ref const(QPointF) greenPoint, ref const(QPointF) bluePoint, 74 TransferFunction fun, float gamma = 0.0f); 75 ~this(); 76 77 @disable this(this); 78 this(ref const(QColorSpace) colorSpace); 79 /+ref QColorSpace operator =(ref const(QColorSpace) colorSpace);+/ 80 81 /+ QColorSpace(QColorSpace &&colorSpace) noexcept 82 : d_ptr(qExchange(colorSpace.d_ptr, nullptr)) 83 { } +/ 84 /+ QColorSpace &operator=(QColorSpace &&colorSpace) noexcept 85 { 86 // Make the deallocation of this->d_ptr happen in ~QColorSpace() 87 QColorSpace(std::move(colorSpace)).swap(*this); 88 return *this; 89 } +/ 90 91 /+ void swap(QColorSpace &colorSpace) noexcept 92 { qSwap(d_ptr, colorSpace.d_ptr); } +/ 93 94 Primaries primaries() const/+ noexcept+/; 95 TransferFunction transferFunction() const/+ noexcept+/; 96 float gamma() const/+ noexcept+/; 97 98 void setTransferFunction(TransferFunction transferFunction, float gamma = 0.0f); 99 QColorSpace withTransferFunction(TransferFunction transferFunction, float gamma = 0.0f) const; 100 101 void setPrimaries(Primaries primariesId); 102 void setPrimaries(ref const(QPointF) whitePoint, ref const(QPointF) redPoint, 103 ref const(QPointF) greenPoint, ref const(QPointF) bluePoint); 104 105 bool isValid() const/+ noexcept+/; 106 107 /+ friend Q_GUI_EXPORT bool operator==(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2); +/ 108 /+ friend inline bool operator!=(const QColorSpace &colorSpace1, const QColorSpace &colorSpace2); +/ 109 110 static QColorSpace fromIccProfile(ref const(QByteArray) iccProfile); 111 QByteArray iccProfile() const; 112 113 QColorTransform transformationToColorSpace(ref const(QColorSpace) colorspace) const; 114 115 /+auto opCast(T : QVariant)() const;+/ 116 117 private: 118 /+ Q_DECLARE_PRIVATE(QColorSpace) +/ 119 QColorSpacePrivate* d_ptr = null; 120 121 /+ #ifndef QT_NO_DEBUG_STREAM 122 friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace); 123 #endif +/ 124 } 125 126 /+bool /+ Q_GUI_EXPORT +/ operator ==(ref const(QColorSpace) colorSpace1, ref const(QColorSpace) colorSpace2);+/ 127 /+pragma(inline, true) bool operator !=(ref const(QColorSpace) colorSpace1, ref const(QColorSpace) colorSpace2) 128 { 129 return !(colorSpace1 == colorSpace2); 130 }+/ 131 132 /+ Q_DECLARE_SHARED(QColorSpace) 133 134 // QColorSpace stream functions 135 #if !defined(QT_NO_DATASTREAM) 136 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QColorSpace &); 137 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QColorSpace &); 138 #endif 139 140 #ifndef QT_NO_DEBUG_STREAM 141 Q_GUI_EXPORT QDebug operator<<(QDebug, const QColorSpace &); 142 #endif +/ 143