File indexing completed on 2024-11-10 04:56:38
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #include "colorlut3d.h" 0010 #include "colortransformation.h" 0011 0012 #include <QVector3D> 0013 0014 namespace KWin 0015 { 0016 0017 ColorLUT3D::ColorLUT3D(std::unique_ptr<ColorTransformation> &&transformation, size_t xSize, size_t ySize, size_t zSize) 0018 : m_transformation(std::move(transformation)) 0019 , m_xSize(xSize) 0020 , m_ySize(ySize) 0021 , m_zSize(zSize) 0022 { 0023 } 0024 0025 size_t ColorLUT3D::xSize() const 0026 { 0027 return m_xSize; 0028 } 0029 0030 size_t ColorLUT3D::ySize() const 0031 { 0032 return m_ySize; 0033 } 0034 0035 size_t ColorLUT3D::zSize() const 0036 { 0037 return m_zSize; 0038 } 0039 0040 QVector3D ColorLUT3D::sample(size_t x, size_t y, size_t z) 0041 { 0042 return m_transformation->transform(QVector3D(x / double(m_xSize - 1), y / double(m_ySize - 1), z / double(m_zSize - 1))); 0043 } 0044 0045 }