File indexing completed on 2024-05-19 05:31:34
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include <memory> 0012 #include <stdint.h> 0013 #include <tuple> 0014 #include <vector> 0015 0016 #include "kwin_export.h" 0017 0018 typedef struct _cmsPipeline_struct cmsPipeline; 0019 class QVector3D; 0020 0021 namespace KWin 0022 { 0023 0024 class ColorPipelineStage; 0025 0026 class KWIN_EXPORT ColorTransformation 0027 { 0028 public: 0029 ColorTransformation(std::vector<std::unique_ptr<ColorPipelineStage>> &&stages); 0030 ~ColorTransformation(); 0031 0032 void append(ColorTransformation *transformation); 0033 0034 bool valid() const; 0035 0036 std::tuple<uint16_t, uint16_t, uint16_t> transform(uint16_t r, uint16_t g, uint16_t b) const; 0037 QVector3D transform(QVector3D in) const; 0038 0039 static std::unique_ptr<ColorTransformation> createScalingTransform(const QVector3D &scale); 0040 0041 private: 0042 cmsPipeline *const m_pipeline; 0043 std::vector<std::unique_ptr<ColorPipelineStage>> m_stages; 0044 bool m_valid = true; 0045 }; 0046 0047 }