39 redPoint =
QPointF(0.640, 0.330);
40 greenPoint =
QPointF(0.300, 0.600);
41 bluePoint =
QPointF(0.150, 0.060);
45 redPoint =
QPointF(0.680, 0.320);
46 greenPoint =
QPointF(0.265, 0.690);
47 bluePoint =
QPointF(0.150, 0.060);
51 redPoint =
QPointF(0.640, 0.330);
52 greenPoint =
QPointF(0.210, 0.710);
53 bluePoint =
QPointF(0.150, 0.060);
57 redPoint =
QPointF(0.7347, 0.2653);
58 greenPoint =
QPointF(0.1596, 0.8404);
59 bluePoint =
QPointF(0.0366, 0.0001);
99 if (wXyz != wXyzD50) {
104 { 0.2664f, 1.7135f, -0.0685f },
105 { -0.1614f, 0.0367f, 1.0296f } };
106 QColorMatrix abradinv = { { 0.9869929f, 0.4323053f, -0.0085287f },
107 { -0.1470543f, 0.5183603f, 0.0400428f },
108 { 0.1599627f, 0.0492912f, 0.9684867f } };
113 if (srcCone.
x && srcCone.
y && srcCone.
z) {
115 { 0, dstCone.
y / srcCone.
y, 0 },
116 { 0, 0, dstCone.
z / srcCone.
z } };
119 QColorMatrix chromaticAdaptation = abradinv * (wToD50 * abrad);
120 toXyz = chromaticAdaptation * toXyz;
134 : namedColorSpace(namedColorSpace)
170 : primaries(primaries)
171 , transferFunction(transferFunction)
182 , transferFunction(transferFunction)
193 : primaries(primaries)
194 , transferFunction(
QColorSpace::TransferFunction::Custom)
204 , transferFunction(
QColorSpace::TransferFunction::Custom)
220 , transferFunction(
QColorSpace::TransferFunction::Custom)
227 greenTransferFunctionTable,
228 blueTransferFunctionTable);
252 if (
qAbs(
gamma - 2.19921875f) < (1/1024.0f)) {
313 if (!
table.isEmpty() && !
table.checkValidity()) {
314 qWarning() <<
"Invalid transfer function table given to QColorSpace";
315 trc[0].
m_type = QColorTrc::Type::Uninitialized;
320 if (
table.asColorTransferFunction(&curve)) {
325 }
else if (curve.
isSRgb()) {
328 trc[0].
m_type = QColorTrc::Type::Function;
345 qWarning() <<
"Invalid transfer function table given to QColorSpace";
346 trc[0].
m_type = QColorTrc::Type::Uninitialized;
347 trc[1].
m_type = QColorTrc::Type::Uninitialized;
348 trc[2].
m_type = QColorTrc::Type::Uninitialized;
354 trc[0].
m_type = QColorTrc::Type::Function;
361 trc[1].
m_type = QColorTrc::Type::Function;
368 trc[2].
m_type = QColorTrc::Type::Function;
381 trc[0].
m_type = QColorTrc::Type::Function;
387 trc[0].
m_type = QColorTrc::Type::Function;
391 trc[0].
m_type = QColorTrc::Type::Function;
397 trc[0].
m_type = QColorTrc::Type::Function;
419 ptr->colorSpaceIn =
this;
422 if (
ptr->isIdentity())
432 ptr->colorSpaceIn =
this;
433 ptr->colorSpaceOut =
this;
527 qWarning() <<
"QColorSpace attempted constructed from invalid QColorSpace::NamedColorSpace: " << int(namedColorSpace);
536 if (atomicRef.testAndSetOrdered(
nullptr, tmp, cspriv))
587 qWarning() <<
"QColorSpace attempted constructed from invalid primaries:" << whitePoint << redPoint << greenPoint << bluePoint;
603 : d_ptr(new
QColorSpacePrivate({whitePoint, redPoint, greenPoint, bluePoint}, transferFunctionTable))
620 redTransferFunctionTable,
621 greenTransferFunctionTable,
622 blueTransferFunctionTable))
734 greenTransferFunctionTable,
735 blueTransferFunctionTable);
742 greenTransferFunctionTable,
743 blueTransferFunctionTable);
777 out.setTransferFunction(transferFunctionTable);
796 out.setTransferFunctions(redTransferFunctionTable, greenTransferFunctionTable, blueTransferFunctionTable);
844 d_ptr->
toXyz = toXyz;
933 if (d_ptr ==
other.d_ptr)
935 if (!d_ptr || !
other.d_ptr)
942 const bool valid2 =
other.isValid();
943 if (valid1 != valid2)
945 if (!valid1 && !valid2) {
969 if (d_ptr->
trc[0] !=
other.d_ptr->trc[0] ||
970 d_ptr->
trc[1] !=
other.d_ptr->trc[1] ||
971 d_ptr->
trc[2] !=
other.d_ptr->trc[2])
986 if (*
this == colorspace)
1033#if !defined(QT_NO_DATASTREAM)
1068#ifndef QT_NO_DEBUG_STREAM
1073 dbg <<
"QColorSpace(";
1074 if (colorSpace.d_ptr) {
1078 dbg <<
", gamma=" << colorSpace.
gamma();
1087#include "moc_qcolorspace.cpp"
\macro Q_ATOMIC_INTnn_IS_SUPPORTED
void storeRelease(T newValue) noexcept
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
QColorMatrix inverted() const
static QColorMatrix fromScale(QColorVector v)
QColorVector map(const QColorVector &c) const
QColorMatrix toXyzMatrix() const
void setTransferFunctionTables(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable)
QColorTransform transformationToColorSpace(const QColorSpacePrivate *out) const
QColorSpace::NamedColorSpace namedColorSpace
void setTransferFunctionTable(const QList< uint16_t > &transferFunctionTable)
QColorTransform transformationToXYZ() const
static Q_CONSTINIT QBasicMutex s_lutWriteLock
void setTransferFunction()
void identifyColorSpace()
struct QColorSpacePrivate::LUT lut
QColorSpace::Primaries primaries
QColorSpace::TransferFunction transferFunction
static constexpr QColorSpace::NamedColorSpace Unknown
The QColorSpace class provides a color space abstraction.
Primaries primaries() const noexcept
Returns the predefined primaries of the color space or primaries::Custom if it doesn't match any of t...
friend class QColorSpacePrivate
Primaries
Predefined sets of primary colors.
QColorTransform transformationToColorSpace(const QColorSpace &colorspace) const
Generates and returns a color space transformation from this color space to colorspace.
bool isValid() const noexcept
Returns true if the color space is valid.
QColorSpace withTransferFunctions(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable) const
Returns a copy of this color space, except using the transfer functions described by redTransferFunct...
void setTransferFunction(TransferFunction transferFunction, float gamma=0.0f)
Sets the transfer function to transferFunction and gamma.
float gamma() const noexcept
Returns the gamma value of color spaces with TransferFunction::Gamma, an approximate gamma value for ...
static QColorSpace fromIccProfile(const QByteArray &iccProfile)
Creates a QColorSpace from ICC profile iccProfile.
TransferFunction transferFunction() const noexcept
Returns the predefined transfer function of the color space or TransferFunction::Custom if it doesn't...
NamedColorSpace
Predefined color spaces.
void setTransferFunctions(const QList< uint16_t > &redTransferFunctionTable, const QList< uint16_t > &greenTransferFunctionTable, const QList< uint16_t > &blueTransferFunctionTable)
Sets the transfer functions to redTransferFunctionTable, greenTransferFunctionTable and blueTransferF...
void setPrimaries(Primaries primariesId)
Sets the primaries to those of the primariesId set.
void setDescription(const QString &description)
Sets the name or short description of the color space to description.
TransferFunction
Predefined transfer functions or gamma curves.
QColorSpace() noexcept=default
Creates a new colorspace object that represents an undefined and invalid colorspace.
QColorSpace withTransferFunction(TransferFunction transferFunction, float gamma=0.0f) const
Returns a copy of this color space, except using the transfer function transferFunction and gamma.
QString description() const noexcept
Returns the name or short description.
QByteArray iccProfile() const
Returns an ICC profile representing the color space.
static QColorTransferFunction fromGamma(float gamma)
static QColorTransferFunction fromProPhotoRgb()
static QColorTransferFunction fromSRgb()
bool checkValidity() const
bool asColorTransferFunction(QColorTransferFunction *transferFn)
QColorTransferFunction m_fun
QColorTransferTable m_table
static constexpr QColorVector D50()
static constexpr QPointF D65Chromaticity()
static bool isValidChromaticity(const QPointF &chr)
static constexpr QPointF D50Chromaticity()
\inmodule QtCore\reentrant
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
qsizetype size() const noexcept
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
QByteArray toIccProfile(const QColorSpace &space)
Combined button and popup list for selecting options.
static void cleanupPredefinedColorspaces()
QDataStream & operator>>(QDataStream &s, QColorSpace &colorSpace)
QDataStream & operator<<(QDataStream &s, const QColorSpace &image)
static Q_CONSTINIT QAtomicPointer< QColorSpacePrivate > s_predefinedColorspacePrivates[QColorSpace::ProPhotoRgb]
bool qFuzzyIsNull(qfloat16 f) noexcept
static ControlElement< T > * ptr(QWidget *widget)
constexpr T qAbs(const T &t)
GLuint GLenum GLenum transform
GLenum GLenum GLsizei void * table
#define QT_DEFINE_QESDP_SPECIALIZATION_DTOR(Class)
#define QStringLiteral(str)
QTextStream out(stdout)
[7]