4#ifndef HELPERCONVERSION_H
5#define HELPERCONVERSION_H
7#include "genericcolor.h"
8#include "helperqttypes.h"
14#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
15#include <qtmetamacros.h>
83#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
84uint qHash(
const ColorModel t, uint seed = 0);
96[[nodiscard]]
constexpr quint8 fromFloatingToEightBit(
const T &original)
99 std::is_floating_point<T>::value,
100 "Template fromFloatingToEightBit() only works with floating point types");
101 const int rounded = qRound(original * 255);
102 const auto bounded = qBound<int>(0, rounded, 255);
103 return static_cast<quint8
>(bounded);
115[[nodiscard]]
QColor qColorFromRgbDouble(T red, T green, T blue)
118 std::is_floating_point<T>::value,
119 "Template fromFloatingToEightBit() only works with floating point types");
121 static_cast<QColorFloatType
>(green),
122 static_cast<QColorFloatType
>(blue));
125[[nodiscard]] cmsCIELab toCmsLab(
const cmsCIELCh &value);
127[[nodiscard]] GenericColor toGenericColorCielabD50(
const cmsCIELab &value);
146constexpr cmsCIEXYZ whitePointD65TwoDegree{0.95047, 1.00000, 1.08883};
The namespace of this library.
ColorModel
Identifiers for color models.
@ OklabD65
The Oklab color space, which by definition always and exclusively uses a D65 illuminant.
@ XyzD50
The Xyz color space using a D50 illuminant.
@ CielabD50
The Cielab color space using a D50 illuminant.
@ OklchD65
The Oklch color space, which by definition always and exclusively uses a D65 illuminant.
@ Hsl360_1_1
Some color space using the HSL color model.
@ Invalid
Represents invalid data.
@ XyzD65
The Xzy color space using a D65 illuminant.
@ Rgb1
Some color space using the Rgb color model.
@ CielchD50
The Cielch color space using a D50 illuminant.
@ Hwb360_1_1
Some color space using the HWB color model.
QColor fromRgbF(float r, float g, float b, float a)