/* SPDX-FileCopyrightText: 2023 Xaver Hugl SPDX-License-Identifier: GPL-2.0-or-later */ #pragma once #include "core/colorspace.h" #include "kwin_export.h" #include #include #include #include typedef void *cmsHPROFILE; namespace KWin { class ColorTransformation; class ColorLUT3D; class KWIN_EXPORT IccProfile { public: struct BToATagData { std::unique_ptr B; std::optional matrix; std::unique_ptr M; std::unique_ptr CLut; std::unique_ptr A; }; explicit IccProfile(cmsHPROFILE handle, const Colorimetry &colorimetry, BToATagData &&bToATag, const std::shared_ptr &vcgt, std::optional minBrightness, std::optional maxBrightness); explicit IccProfile(cmsHPROFILE handle, const Colorimetry &colorimetry, const std::shared_ptr &inverseEOTF, const std::shared_ptr &vcgt, std::optional minBrightness, std::optional maxBrightness); ~IccProfile(); /** * the BToA tag describes a transformation from XYZ with D50 whitepoint * to the display color space. May be nullptr! */ const BToATagData *BtToATag() const; /** * Contains the inverse of the TRC tags. May be nullptr! */ std::shared_ptr inverseEOTF() const; /** * The VCGT is a non-standard tag that needs to be applied before * pixels are sent to the display. May be nullptr! */ std::shared_ptr vcgt() const; const Colorimetry &colorimetry() const; std::optional minBrightness() const; std::optional maxBrightness() const; static std::unique_ptr load(const QString &path); private: cmsHPROFILE const m_handle; const Colorimetry m_colorimetry; const std::optional m_bToATag; const std::shared_ptr m_inverseEOTF; const std::shared_ptr m_vcgt; const std::optional m_minBrightness; const std::optional m_maxBrightness; }; }