QColorSpace Class
The QColorSpace class provides a color space abstraction. More...
| Header: | #include <QColorSpace> |
| qmake: | QT += gui |
| Since: | Qt 5.14 |
This class was introduced in Qt 5.14.
Public Types
| enum | NamedColorSpace { SRgb, SRgbLinear, AdobeRgb, DisplayP3, ProPhotoRgb } |
| enum class | Primaries { Custom, SRgb, AdobeRgb, DciP3D65, ProPhotoRgb } |
| enum class | TransferFunction { Custom, Linear, Gamma, SRgb, ProPhotoRgb } |
Detailed Description
Color values can be interpreted in different ways, and based on the interpretation can live in different spaces. We call this color spaces.
QColorSpace provides access to creating several predefined color spaces and can generate QColorTransforms for converting colors from one color space to another.
QColorSpace can also represent color spaces defined by ICC profiles or embedded in images, that do not otherwise fit the predefined color spaces.
A color space can generally speaking be conceived as a combination of set of primary colors and a transfer function. The primaries defines the axes of the color space, and the transfer function how values are mapped on the axes. The primaries are defined by three primary colors that represent exactly how red, green, and blue look in this particular color space, and a white color that represents where and how bright pure white is. The range of colors expressable by the primary colors is called the gamut, and a color space that can represent a wider range of colors is also known as a wide-gamut color space.
The transfer function or gamma curve determines how each component in the color space is encoded. These are used because human perception does not operate linearly, and the transfer functions try to ensure that colors will seem evenly spaced to human eyes.
Member Type Documentation
enum QColorSpace::NamedColorSpace
Predefined color spaces.
| Constant | Value | Description |
|---|---|---|
QColorSpace::SRgb | 1 | The sRGB color space, which Qt operates in by default. It is a close approximation of how most classic monitors operate, and a mode most software and hardware support. ICC registration of sRGB. |
QColorSpace::SRgbLinear | 2 | The sRGB color space with linear gamma. Useful for gamma-corrected blending. |
QColorSpace::AdobeRgb | 3 | The Adobe RGB color space is a classic wide-gamut color space, using a gamma of 2.2. ICC registration of Adobe RGB (1998) |
QColorSpace::DisplayP3 | 4 | A color-space using the primaries of DCI-P3, but with the whitepoint and transfer function of sRGB. Common in modern wide-gamut screens. ICC registration of DCI-P3 |
QColorSpace::ProPhotoRgb | 5 | The Pro Photo RGB color space, also known as ROMM RGB is a very wide gamut color space. ICC registration of ROMM RGB |
enum class QColorSpace::Primaries
Predefined sets of primary colors.
| Constant | Value | Description |
|---|---|---|
QColorSpace::Primaries::Custom | 0 | The primaries are undefined or does not match any predefined sets. |
QColorSpace::Primaries::SRgb | 1 | The sRGB primaries |
QColorSpace::Primaries::AdobeRgb | 2 | The Adobe RGB primaries |
QColorSpace::Primaries::DciP3D65 | 3 | The DCI-P3 primaries with the D65 whitepoint |
QColorSpace::Primaries::ProPhotoRgb | 4 | The ProPhoto RGB primaries with the D50 whitepoint |
enum class QColorSpace::TransferFunction
Predefined transfer functions or gamma curves.
| Constant | Value | Description |
|---|---|---|
QColorSpace::TransferFunction::Custom | 0 | The custom or null transfer function |
QColorSpace::TransferFunction::Linear | 1 | The linear transfer functions |
QColorSpace::TransferFunction::Gamma | 2 | A transfer function that is a real gamma curve based on the value of gamma() |
QColorSpace::TransferFunction::SRgb | 3 | The sRGB transfer function, composed of linear and gamma parts |
QColorSpace::TransferFunction::ProPhotoRgb | 4 | The ProPhoto RGB transfer function, composed of linear and gamma parts |