QtBase  v6.3.1
qcolorspace_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QCOLORSPACE_P_H
41 #define QCOLORSPACE_P_H
42 
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include "qcolorspace.h"
55 #include "qcolormatrix_p.h"
56 #include "qcolortrc_p.h"
57 #include "qcolortrclut_p.h"
58 
59 #include <QtCore/qmutex.h>
60 #include <QtCore/qpoint.h>
61 #include <QtCore/qshareddata.h>
62 
63 #include <memory>
64 
66 
68 {
69 public:
70  QColorSpacePrimaries() = default;
73  QPointF redPoint,
74  QPointF greenPoint,
75  QPointF bluePoint)
76  : whitePoint(whitePoint)
77  , redPoint(redPoint)
78  , greenPoint(greenPoint)
79  , bluePoint(bluePoint)
80  { }
81 
82  QColorMatrix toXyzMatrix() const;
83  bool areValid() const;
84 
89 };
90 
92 {
93 public:
99  QColorSpacePrivate(const QColorSpacePrimaries &primaries, const QList<uint16_t> &transferFunctionTable);
101  const QList<uint16_t> &redTransferFunctionTable,
102  const QList<uint16_t> &greenTransferFunctionTable,
103  const QList<uint16_t> &blueRransferFunctionTable);
105 
106  static const QColorSpacePrivate *get(const QColorSpace &colorSpace)
107  {
108  return colorSpace.d_ptr.get();
109  }
110 
111  static QColorSpacePrivate *get(QColorSpace &colorSpace)
112  {
113  return colorSpace.d_ptr.get();
114  }
115 
116  void initialize();
117  void setToXyzMatrix();
118  void setTransferFunction();
119  void identifyColorSpace();
120  void setTransferFunctionTable(const QList<uint16_t> &transferFunctionTable);
121  void setTransferFunctionTables(const QList<uint16_t> &redTransferFunctionTable,
122  const QList<uint16_t> &greenTransferFunctionTable,
123  const QList<uint16_t> &blueTransferFunctionTable);
126 
129 
132  float gamma = 0.0f;
134 
137 
141 
143  struct LUT {
144  LUT() = default;
145  ~LUT() = default;
146  LUT(const LUT &other)
147  {
148  if (other.generated.loadAcquire()) {
149  table[0] = other.table[0];
150  table[1] = other.table[1];
151  table[2] = other.table[2];
153  }
154  }
155  std::shared_ptr<QColorTrcLut> &operator[](int i) { return table[i]; }
156  const std::shared_ptr<QColorTrcLut> &operator[](int i) const { return table[i]; }
157  std::shared_ptr<QColorTrcLut> table[3];
159  } mutable lut;
160 };
161 
163 
164 #endif // QCOLORSPACE_P_H
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
The QAtomicInt class provides platform-independent atomic operations on int.
Definition: qatomic.h:158
void storeRelaxed(T newValue) noexcept
Definition: qbasicatomic.h:91
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
The QColorSpace class provides a color space abstraction.
Definition: qcolorspace.h:57
QColorSpacePrimaries()=default
QColorSpacePrimaries(QPointF whitePoint, QPointF redPoint, QPointF greenPoint, QPointF bluePoint)
Definition: qcolorspace_p.h:72
void setTransferFunctionTables(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable)
static QBasicMutex s_lutWriteLock
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 QColorSpacePrivate * get(QColorSpace &colorSpace)
QColorTrc trc[3]
static const QColorSpacePrivate * get(const QColorSpace &colorSpace)
QByteArray iccProfile
struct QColorSpacePrivate::LUT lut
QColorSpace::Primaries primaries
QColorSpace::TransferFunction transferFunction
QColorMatrix toXyz
static constexpr QColorSpace::NamedColorSpace Unknown
The QColorTransform class is a transformation between color spaces.
T * get() const noexcept
Definition: qshareddata.h:172
The QMutex class provides access serialization between threads.
Definition: qmutex.h:285
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:242
The QSharedData class is a base class for shared data objects. \reentrant.
Definition: qshareddata.h:55
The QString class provides a Unicode character string.
Definition: qstring.h:388
#define Q_AUTOTEST_EXPORT
Definition: qglobal.h:579
GLenum GLenum GLsizei void * table
Definition: qopenglext.h:2745
QTextStream out(stdout)
[7]
QSharedPointer< T > other(t)
[5]
const std::shared_ptr< QColorTrcLut > & operator[](int i) const
LUT(const LUT &other)
std::shared_ptr< QColorTrcLut > & operator[](int i)