Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qcolorspace_p.h
Go to the documentation of this file.
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 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 "qcolormatrix_p.h"
20#include "qcolortrc_p.h"
21#include "qcolortrclut_p.h"
22
23#include <QtCore/qmutex.h>
24#include <QtCore/qpoint.h>
25#include <QtCore/qshareddata.h>
26
27#include <memory>
28
30
32{
33public:
37 QPointF redPoint,
38 QPointF greenPoint,
39 QPointF bluePoint)
40 : whitePoint(whitePoint)
41 , redPoint(redPoint)
42 , greenPoint(greenPoint)
43 , bluePoint(bluePoint)
44 { }
45
46 QColorMatrix toXyzMatrix() const;
47 bool areValid() const;
48
53};
54
56{
57public:
63 QColorSpacePrivate(const QColorSpacePrimaries &primaries, const QList<uint16_t> &transferFunctionTable);
65 const QList<uint16_t> &redTransferFunctionTable,
66 const QList<uint16_t> &greenTransferFunctionTable,
67 const QList<uint16_t> &blueRransferFunctionTable);
69
70 static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
71 {
72 return colorSpace.d_ptr.get();
73 }
74
75 static QColorSpacePrivate *get(QColorSpace &colorSpace)
76 {
77 return colorSpace.d_ptr.get();
78 }
79
80 void initialize();
81 void setToXyzMatrix();
83 void identifyColorSpace();
84 void setTransferFunctionTable(const QList<uint16_t> &transferFunctionTable);
85 void setTransferFunctionTables(const QList<uint16_t> &redTransferFunctionTable,
86 const QList<uint16_t> &greenTransferFunctionTable,
87 const QList<uint16_t> &blueTransferFunctionTable);
90
93
96 float gamma = 0.0f;
98
101
105
106 Q_CONSTINIT static QBasicMutex s_lutWriteLock;
107 struct LUT {
108 LUT() = default;
109 ~LUT() = default;
110 LUT(const LUT &other)
111 {
112 if (other.generated.loadAcquire()) {
113 table[0] = other.table[0];
114 table[1] = other.table[1];
115 table[2] = other.table[2];
117 }
118 }
119 std::shared_ptr<QColorTrcLut> &operator[](int i) { return table[i]; }
120 const std::shared_ptr<QColorTrcLut> &operator[](int i) const { return table[i]; }
121 std::shared_ptr<QColorTrcLut> table[3];
123 } mutable lut;
124};
125
127
128#endif // QCOLORSPACE_P_H
\inmodule QtCore
Definition qatomic.h:112
void storeRelaxed(T newValue) noexcept
\inmodule QtCore
Definition qbytearray.h:57
QColorSpacePrimaries()=default
QColorSpacePrimaries(QPointF whitePoint, QPointF redPoint, QPointF greenPoint, QPointF bluePoint)
void setTransferFunctionTables(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable)
QColorVector whitePoint
QColorTransform transformationToColorSpace(const QColorSpacePrivate *out) const
QColorSpace::NamedColorSpace namedColorSpace
void setTransferFunctionTable(const QList< uint16_t > &transferFunctionTable)
QColorTransform transformationToXYZ() const
QColorSpacePrivate(const QColorSpacePrivate &other)=default
static const QColorSpacePrivate * get(const QColorSpace &colorSpace)
static Q_CONSTINIT QBasicMutex s_lutWriteLock
static QColorSpacePrivate * get(QColorSpace &colorSpace)
struct QColorSpacePrivate::LUT lut
QColorSpace::Primaries primaries
QColorSpace::TransferFunction transferFunction
static constexpr QColorSpace::NamedColorSpace Unknown
The QColorSpace class provides a color space abstraction.
Definition qcolorspace.h:21
Primaries
Predefined sets of primary colors.
Definition qcolorspace.h:32
NamedColorSpace
Predefined color spaces.
Definition qcolorspace.h:24
TransferFunction
Predefined transfer functions or gamma curves.
Definition qcolorspace.h:40
The QColorTransform class is a transformation between color spaces.
T * get() const noexcept
Definition qlist.h:74
\inmodule QtCore
Definition qmutex.h:285
\inmodule QtCore\reentrant
Definition qpoint.h:214
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
Combined button and popup list for selecting options.
GLenum GLenum GLsizei void * table
#define Q_AUTOTEST_EXPORT
QTextStream out(stdout)
[7]
QSharedPointer< T > other(t)
[5]
LUT(const LUT &other)
const std::shared_ptr< QColorTrcLut > & operator[](int i) const
std::shared_ptr< QColorTrcLut > & operator[](int i)