1 | // Copyright (C) 2018 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QCOLORTRANSFORM_H |
5 | #define QCOLORTRANSFORM_H |
6 | |
7 | #include <QtGui/qtguiglobal.h> |
8 | #include <QtGui/qrgb.h> |
9 | #include <QtCore/qshareddata.h> |
10 | |
11 | QT_BEGIN_NAMESPACE |
12 | |
13 | class QColor; |
14 | class QRgba64; |
15 | class QColorSpacePrivate; |
16 | class QColorTransformPrivate; |
17 | class qfloat16; |
18 | template<typename T> |
19 | class QRgbaFloat; |
20 | typedef QRgbaFloat<qfloat16> QRgbaFloat16; |
21 | typedef QRgbaFloat<float> QRgbaFloat32; |
22 | |
23 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QColorTransformPrivate, Q_GUI_EXPORT) |
24 | |
25 | class QColorTransform |
26 | { |
27 | public: |
28 | QColorTransform() noexcept = default; |
29 | Q_GUI_EXPORT ~QColorTransform(); |
30 | Q_GUI_EXPORT QColorTransform(const QColorTransform &colorTransform) noexcept; |
31 | QColorTransform(QColorTransform &&colorTransform) = default; |
32 | QColorTransform &operator=(const QColorTransform &other) noexcept |
33 | { |
34 | QColorTransform{other}.swap(other&: *this); |
35 | return *this; |
36 | } |
37 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QColorTransform) |
38 | |
39 | void swap(QColorTransform &other) noexcept { d.swap(other&: other.d); } |
40 | Q_GUI_EXPORT bool isIdentity() const noexcept; |
41 | |
42 | Q_GUI_EXPORT QRgb map(QRgb argb) const; |
43 | Q_GUI_EXPORT QRgba64 map(QRgba64 rgba64) const; |
44 | Q_GUI_EXPORT QRgbaFloat16 map(QRgbaFloat16 rgbafp16) const; |
45 | Q_GUI_EXPORT QRgbaFloat32 map(QRgbaFloat32 rgbafp32) const; |
46 | Q_GUI_EXPORT QColor map(const QColor &color) const; |
47 | |
48 | friend bool operator==(const QColorTransform &ct1, const QColorTransform &ct2) |
49 | { return ct1.compare(other: ct2); } |
50 | friend bool operator!=(const QColorTransform &ct1, const QColorTransform &ct2) |
51 | { return !ct1.compare(other: ct2); } |
52 | |
53 | private: |
54 | friend class QColorSpacePrivate; |
55 | friend class QColorTransformPrivate; |
56 | Q_GUI_EXPORT bool compare(const QColorTransform &other) const; |
57 | |
58 | QExplicitlySharedDataPointer<QColorTransformPrivate> d; |
59 | }; |
60 | |
61 | Q_DECLARE_SHARED(QColorTransform) |
62 | |
63 | QT_END_NAMESPACE |
64 | |
65 | #endif // QCOLORTRANSFORM_H |
66 |