Warning, file /office/calligra/libs/pigment/KoXyzColorSpaceTraits.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2006-2007 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public License 0015 * along with this library; see the file COPYING.LIB. If not, write to 0016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef _KO_XYZ_COLORSPACE_TRAITS_H_ 0021 #define _KO_XYZ_COLORSPACE_TRAITS_H_ 0022 0023 0024 0025 /** 0026 * Base class for Xyz traits, it provides some convenient functions to 0027 * access Xyz channels through an explicit API. 0028 */ 0029 template<typename _channels_type_> 0030 struct KoXyzTraits : public KoColorSpaceTrait<_channels_type_, 4, 3> { 0031 0032 typedef _channels_type_ channels_type; 0033 typedef KoColorSpaceTrait<_channels_type_, 4, 3> parent; 0034 0035 static const qint32 x_pos = 0; 0036 static const qint32 y_pos = 1; 0037 static const qint32 z_pos = 2; 0038 0039 /** 0040 * An Xyz pixel 0041 */ 0042 struct Pixel { 0043 channels_type x; 0044 channels_type y; 0045 channels_type z; 0046 channels_type alpha; 0047 }; 0048 0049 /// @return the x component 0050 inline static channels_type x(quint8* data) { 0051 channels_type* d = parent::nativeArray(data); 0052 return d[x_pos]; 0053 } 0054 /// Set the x component 0055 inline static void setX(quint8* data, channels_type nv) { 0056 channels_type* d = parent::nativeArray(data); 0057 d[x_pos] = nv; 0058 } 0059 /// @return the y component 0060 inline static channels_type y(quint8* data) { 0061 channels_type* d = parent::nativeArray(data); 0062 return d[y_pos]; 0063 } 0064 /// Set the y component 0065 inline static void setY(quint8* data, channels_type nv) { 0066 channels_type* d = parent::nativeArray(data); 0067 d[y_pos] = nv; 0068 } 0069 /// @return the z component 0070 inline static channels_type z(quint8* data) { 0071 channels_type* d = parent::nativeArray(data); 0072 return d[z_pos]; 0073 } 0074 /// Set the z component 0075 inline static void setZ(quint8* data, channels_type nv) { 0076 channels_type* d = parent::nativeArray(data); 0077 d[z_pos] = nv; 0078 } 0079 }; 0080 0081 0082 struct KoXyzU8Traits : public KoXyzTraits<quint8> { 0083 }; 0084 0085 struct KoXyzU16Traits : public KoXyzTraits<quint16> { 0086 }; 0087 0088 #include <KoConfig.h> 0089 #ifdef HAVE_OPENEXR 0090 #include <half.h> 0091 0092 struct KoXyzF16Traits : public KoXyzTraits<half> { 0093 }; 0094 0095 #endif 0096 0097 struct KoXyzF32Traits : public KoXyzTraits<float> { 0098 }; 0099 0100 struct KoXyzF64Traits : public KoXyzTraits<double> { 0101 }; 0102 0103 #endif