Krita Source Code Documentation
Loading...
Searching...
No Matches
KoColorProfileQuery.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Wolthera van Hövell tot Westerflier <griffinvalley@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6#ifndef KOCOLORPROFILEQUERY_H
7#define KOCOLORPROFILEQUERY_H
8
11#include <QDebug>
12
27
30
33
36
39
40 std::optional<double> hdrReferenceWhite;
41
42 inline bool isValid() const {
43 return isGrayscale() || isRgb();
44 }
45
46 inline bool isGrayscale() const {
48 && rgbColorants.isEmpty()
50 && !(whitePoint == KoColorimetryUtils::xy{0.0, 0.0});
51 }
52
53 inline bool isRgb() const {
56 || (!rgbColorants.isEmpty() && !(whitePoint == KoColorimetryUtils::xy{0.0, 0.0})));
57 }
58
59 inline bool operator==(const KoColorProfileQuery &rhs) const {
60 return whitePoint == rhs.whitePoint
62 && primaries == rhs.primaries
63 && transfer == rhs.transfer
65 }
66
67 inline bool operator!=(const KoColorProfileQuery &rhs) const {
68 return !(*this == rhs);
69 }
70
71};
72
73inline QDebug operator<<(QDebug debug, const KoColorProfileQuery &value) {
74 QDebugStateSaver saver(debug);
75 debug.nospace() << "KoColorProfileQuery("
76 << " WhitePoint:" << value.whitePoint
77 << " rgbColorants:" << value.rgbColorants
78 << " primariesType:" << value.primaries
79 << " transferFunction:" << value.transfer
80 << " isGreyscale:" << value.isGrayscale()
81 << " isRgb:" << value.isRgb()
82 << " isValid:" << value.isValid()
83 << ")";
84 return debug;
85}
86
87#endif // KOCOLORPROFILEQUERY_H
float value(const T *src, size_t ch)
ColorPrimaries
The colorPrimaries enum Enum of colorants, follows ITU H.273 for values 0 to 255, and has extra known...
@ PRIMARIES_UNSPECIFIED
TransferCharacteristics
The transferCharacteristics enum Enum of transfer characteristics, follows ITU H.273 for values 0 to ...
QDebug operator<<(QDebug debug, const KoColorProfileQuery &value)
The KoColorProfileQuery struct.
TransferCharacteristics transfer
CICP-compatible enum value representing the white point and primaries.
ColorPrimaries primaries
Rgb Primaries of the profile. When empty, this is a query for a greyscale profile.
bool isValid() const
Used for PQ profiles.
KoColorProfileQuery(KoColorProfileQuery &&rhs)=default
KoColorProfileQuery(const KoColorProfileQuery &rhs)=default
KoColorProfileQuery(ColorPrimaries primaries=PRIMARIES_UNSPECIFIED, TransferCharacteristics transfer=TRC_UNSPECIFIED, std::optional< qreal > hdrReferenceWhite=std::nullopt)
QList< KoColorimetryUtils::xy > rgbColorants
The desired white point of the profile.
bool operator!=(const KoColorProfileQuery &rhs) const
bool operator==(const KoColorProfileQuery &rhs) const
KoColorimetryUtils::xy whitePoint
KoColorProfileQuery & operator=(KoColorProfileQuery &&rhs)=default
KoColorProfileQuery & operator=(const KoColorProfileQuery &rhs)=default
std::optional< double > hdrReferenceWhite
CICP-compatible enum value representing the transfer function.