1// Copyright (C) 2019 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_P_H
5#define QCOLORTRANSFORM_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qcolormatrix_p.h"
19#include "qcolorspace_p.h"
20
21#include <QtCore/qshareddata.h>
22#include <QtGui/qrgbafloat.h>
23
24QT_BEGIN_NAMESPACE
25class QCmyk32;
26
27class QColorTransformPrivate : public QSharedData
28{
29public:
30 QColorMatrix colorMatrix; // Combined colorSpaceIn->toXyz and colorSpaceOut->toXyz.inverted()
31 QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceIn;
32 QExplicitlySharedDataPointer<const QColorSpacePrivate> colorSpaceOut;
33
34 static QColorTransformPrivate *get(const QColorTransform &q)
35 { return q.d.data(); }
36
37 void updateLutsIn() const;
38 void updateLutsOut() const;
39 bool isIdentity() const;
40
41 Q_GUI_EXPORT void prepare();
42 enum TransformFlag {
43 Unpremultiplied = 0,
44 InputOpaque = 1,
45 InputPremultiplied = 2,
46 OutputPremultiplied = 4,
47 Premultiplied = (InputPremultiplied | OutputPremultiplied)
48 };
49 Q_DECLARE_FLAGS(TransformFlags, TransformFlag)
50
51 QColorVector map(QColorVector color) const;
52 QColorVector mapExtended(QColorVector color) const;
53
54 template<typename D, typename S>
55 void apply(D *dst, const S *src, qsizetype count, TransformFlags flags) const;
56
57private:
58 void pcsAdapt(QColorVector *buffer, qsizetype len) const;
59 template<typename S>
60 void applyConvertIn(const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
61 template<typename D, typename S>
62 void applyConvertOut(D *dst, const S *src, QColorVector *buffer, qsizetype len, TransformFlags flags) const;
63};
64
65QT_END_NAMESPACE
66
67#endif // QCOLORTRANSFORM_P_H
68

Provided by KDAB

Privacy Policy
Learn Advanced QML with KDAB
Find out more

source code of qtbase/src/gui/painting/qcolortransform_p.h