File indexing completed on 2024-05-12 15:59:30
0001 /* 0002 * SPDX-FileCopyrightText: 2006, 2007, 2010 Cyrille Berger <cberger@cberger.net> 0003 * SPDX-FileCopyrightText: 2017, 2020 L. E. Segovia <amy@amyspark.me> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef KOCMYKCOLORSPACEMATHS_H_ 0009 #define KOCMYKCOLORSPACEMATHS_H_ 0010 0011 #include <cmath> 0012 #include <limits> 0013 0014 #include "kritapigment_export.h" 0015 #include <KoIntegerMaths.h> 0016 #include "KoChannelInfo.h" 0017 #include "KoLut.h" 0018 0019 #include <KoColorSpaceMaths.h> 0020 0021 #undef _T 0022 0023 /** 0024 * This is an empty mainWindow that needs to be "specialized" for each possible 0025 * numerical type (quint8, quint16...). 0026 * 0027 * It needs to defines some static constant fields : 0028 * - zeroValue : the zero for this numerical type 0029 * - unitValue : the maximum value of the normal dynamic range 0030 * - max : the maximum value 0031 * - min : the minimum value 0032 * - epsilon : a value close to zero but different of zero 0033 * - bits : the bit depth 0034 * 0035 * And some types : 0036 * - compositetype the type used for composite operations (usually one with 0037 * a higher bit depth) 0038 * 0039 * This class is specialized to handle the floating point bounds of the CMYK color space. 0040 */ 0041 template<typename _T> 0042 class KoCmykColorSpaceMathsTraits 0043 { 0044 public: 0045 }; 0046 0047 /** 0048 * No changes for integer color spaces. 0049 */ 0050 template<> 0051 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<quint8> : public KoColorSpaceMathsTraits<quint8> 0052 { 0053 }; 0054 0055 template<> 0056 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<quint16> : public KoColorSpaceMathsTraits<quint16> 0057 { 0058 }; 0059 0060 template<> 0061 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<qint16> : public KoColorSpaceMathsTraits<qint16> 0062 { 0063 }; 0064 0065 template<> 0066 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<quint32> : public KoColorSpaceMathsTraits<quint32> 0067 { 0068 }; 0069 0070 #include <KoConfig.h> 0071 #ifdef HAVE_OPENEXR 0072 #include <half.h> 0073 0074 template<> 0075 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<half> : public KoColorSpaceMathsTraits<half> 0076 { 0077 public: 0078 static const half zeroValueCMYK; 0079 static const half unitValueCMYK; 0080 static const half halfValueCMYK; 0081 }; 0082 #endif 0083 0084 template<> 0085 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<float> : public KoColorSpaceMathsTraits<float> 0086 { 0087 public: 0088 static const float zeroValueCMYK; 0089 static const float unitValueCMYK; 0090 static const float halfValueCMYK; 0091 }; 0092 0093 template<> 0094 class KRITAPIGMENT_EXPORT KoCmykColorSpaceMathsTraits<double> : public KoColorSpaceMathsTraits<double> 0095 { 0096 public: 0097 static const double zeroValueCMYK; 0098 static const double unitValueCMYK; 0099 static const double halfValueCMYK; 0100 }; 0101 0102 #endif