Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qcolorspace_p.h
Go to the documentation of this file.
1// Copyright (C) 2024 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 QCOLORSPACE_P_H
5#define QCOLORSPACE_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 "qcolorspace.h"
19#include "qcolorclut_p.h"
20#include "qcolormatrix_p.h"
21#include "qcolortrc_p.h"
22#include "qcolortrclut_p.h"
23
24#include <QtCore/qmutex.h>
25#include <QtCore/qpoint.h>
26#include <QtCore/qshareddata.h>
27
28#include <memory>
29
31
32bool qColorSpacePrimaryPointsAreValid(const QColorSpace::PrimaryPoints &primaries);
33
35{
36public:
41 QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries, QColorSpace::TransferFunction transferFunction, float gamma);
42 QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries, const QList<uint16_t> &transferFunctionTable);
43 QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries,
44 const QList<uint16_t> &redTransferFunctionTable,
45 const QList<uint16_t> &greenTransferFunctionTable,
46 const QList<uint16_t> &blueRransferFunctionTable);
47 QColorSpacePrivate(QPointF whitePoint, QColorSpace::TransferFunction transferFunction, float gamma);
48 QColorSpacePrivate(QPointF whitePoint, const QList<uint16_t> &transferFunctionTable);
49 QColorSpacePrivate(const QColorSpacePrivate &other) = default;
50
51 static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
52 {
53 return colorSpace.d_ptr.get();
54 }
55
56 static QColorSpacePrivate *get(QColorSpace &colorSpace)
57 {
58 return colorSpace.d_ptr.get();
59 }
60
61 bool equals(const QColorSpacePrivate *other) const;
62 bool isValid() const noexcept;
63
64 void initialize();
65 void setToXyzMatrix();
67 void identifyColorSpace();
68 void setTransferFunctionTable(const QList<uint16_t> &transferFunctionTable);
69 void setTransferFunctionTables(const QList<uint16_t> &redTransferFunctionTable,
70 const QList<uint16_t> &greenTransferFunctionTable,
71 const QList<uint16_t> &blueTransferFunctionTable);
74
75 bool isThreeComponentMatrix() const;
77
80
85 float gamma = 0.0f;
86 QColorVector whitePoint;
87
88 // Three component matrix data:
89 QColorTrc trc[3];
92
93 // Element list processing data:
95 QColorTrc trc[4];
96 };
98 bool isPcsLab = false;
99 // A = device, B = PCS
101
102 // Metadata
106
107 // Cached tables for three component matrix transform:
108 Q_CONSTINIT static QBasicMutex s_lutWriteLock;
109 struct LUT {
110 LUT() = default;
111 ~LUT() = default;
112 LUT(const LUT &other)
113 {
114 if (other.generated.loadAcquire()) {
115 table[0] = other.table[0];
116 table[1] = other.table[1];
117 table[2] = other.table[2];
118 generated.storeRelaxed(1);
119 }
120 }
121 std::shared_ptr<QColorTrcLut> &operator[](int i) { return table[i]; }
122 const std::shared_ptr<QColorTrcLut> &operator[](int i) const { return table[i]; }
125 } mutable lut;
126};
127
128QT_END_NAMESPACE
129
130#endif // QCOLORSPACE_P_H
QColorMatrix inverted() const
static QColorMatrix identity()
static QColorMatrix fromScale(QColorVector v)
friend constexpr QColorMatrix operator*(const QColorMatrix &a, const QColorMatrix &o)
QColorVector map(const QColorVector &c) const
void setTransferFunctionTables(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable)
QColorSpacePrivate(QPointF whitePoint, const QList< uint16_t > &transferFunctionTable)
QColorVector whitePoint
QColorSpacePrivate(QPointF whitePoint, QColorSpace::TransferFunction transferFunction, float gamma)
QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries, const QList< uint16_t > &transferFunctionTable)
QColorTransform transformationToColorSpace(const QColorSpacePrivate *out) const
QList< Element > mAB
QList< Element > mBA
void clearElementListProcessingForEdit()
QColorMatrix chad
void setTransferFunctionTable(const QList< uint16_t > &transferFunctionTable)
QColorTransform transformationToXYZ() const
bool isThreeComponentMatrix() const
QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries, const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueRransferFunctionTable)
QColorSpacePrivate(const QColorSpacePrivate &other)=default
static const QColorSpacePrivate * get(const QColorSpace &colorSpace)
QColorSpacePrivate(const QColorSpace::PrimaryPoints &primaries, QColorSpace::TransferFunction transferFunction, float gamma)
static QColorSpacePrivate * get(QColorSpace &colorSpace)
bool isValid() const noexcept
QColorMatrix toXyz
QColorSpacePrivate(QColorSpace::NamedColorSpace namedColorSpace)
bool equals(const QColorSpacePrivate *other) const
The QColorTransform class is a transformation between color spaces.
Combined button and popup list for selecting options.
static void cleanupPredefinedColorspaces()
static bool compareElement(const QColorSpacePrivate::TransferElement &element, const QColorSpacePrivate::TransferElement &other)
QDebug operator<<(QDebug dbg, const QColorCLUT &)
QDebug operator<<(QDebug dbg, const QColorSpace &colorSpace)
QDebug operator<<(QDebug dbg, const QColorMatrix &)
static bool compareElement(const QColorMatrix &element, const QColorMatrix &other)
QDataStream & operator>>(QDataStream &s, QColorSpace &colorSpace)
QDataStream & operator<<(QDataStream &s, const QColorSpace &image)
QDebug operator<<(QDebug dbg, const QColorVector &)
QColorMatrix qColorSpacePrimaryPointsToXyzMatrix(const QColorSpace::PrimaryPoints &primaries)
static bool compareElements(const T &element, const QColorSpacePrivate::Element &other)
static bool compareElement(const QColorCLUT &element, const QColorCLUT &other)
static bool compareElement(const QColorVector &element, const QColorVector &other)
QDebug operator<<(QDebug dbg, const QColorSpacePrivate::TransferElement &)
QT_BEGIN_NAMESPACE bool qColorSpacePrimaryPointsAreValid(const QColorSpace::PrimaryPoints &primaries)
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
LUT(const LUT &other)
const std::shared_ptr< QColorTrcLut > & operator[](int i) const
std::shared_ptr< QColorTrcLut > & operator[](int i)
std::shared_ptr< QColorTrcLut > table[3]