File indexing completed on 2024-06-23 04:26:03
0001 /* 0002 * This file is part of the KDE project 0003 * SPDX-FileCopyrightText: 2000 Matthias Elter <elter@kde.org> 0004 * SPDX-FileCopyrightText: 2004 Boudewijn Rempt <boud@valdyas.org> 0005 * SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org> 0006 * 0007 * SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #ifndef _KO_LCMS_COLORPROFILE_H 0011 #define _KO_LCMS_COLORPROFILE_H 0012 0013 #include "IccColorProfile.h" 0014 0015 #include <lcms2.h> 0016 0017 #include <QByteArray> 0018 #include <QString> 0019 0020 /** 0021 * This class contains an LCMS color profile. Don't use it outside LcmsColorSpace. 0022 */ 0023 class LcmsColorProfileContainer : public IccColorProfile::Container 0024 { 0025 friend class IccColorProfile; 0026 protected: 0027 LcmsColorProfileContainer(IccColorProfile::Data *); 0028 private: 0029 /** 0030 * Create a byte array from a lcms profile. 0031 */ 0032 static QByteArray lcmsProfileToByteArray(const cmsHPROFILE profile); 0033 0034 public: 0035 /** 0036 * @param profile lcms memory structure with the profile, it is freed after the call 0037 * to this function 0038 * @return an ICC profile created from an LCMS profile 0039 */ 0040 static IccColorProfile *createFromLcmsProfile(const cmsHPROFILE profile); 0041 public: 0042 0043 ~LcmsColorProfileContainer() override; 0044 0045 /** 0046 * @return the ICC color space signature 0047 */ 0048 cmsColorSpaceSignature colorSpaceSignature() const; 0049 /** 0050 * @return the class of the color space signature 0051 */ 0052 cmsProfileClassSignature deviceClass() const; 0053 /** 0054 * @return the name of the manufacturer 0055 */ 0056 QString manufacturer() const override; 0057 /** 0058 * @return the embedded copyright 0059 */ 0060 QString copyright() const override; 0061 /** 0062 * @return the structure to use with LCMS functions 0063 */ 0064 cmsHPROFILE lcmsProfile() const; 0065 0066 bool valid() const override; 0067 virtual float version() const; 0068 0069 bool isSuitableForOutput() const override; 0070 0071 bool isSuitableForPrinting() const override; 0072 0073 bool isSuitableForDisplay() const override; 0074 0075 virtual bool supportsPerceptual() const; 0076 virtual bool supportsSaturation() const; 0077 virtual bool supportsAbsolute() const; 0078 virtual bool supportsRelative() const; 0079 0080 bool hasColorants() const override; 0081 virtual bool hasTRC() const; 0082 bool isLinear() const; 0083 QVector <double> getColorantsXYZ() const override; 0084 QVector <double> getColorantsxyY() const override; 0085 QVector <double> getWhitePointXYZ() const override; 0086 QVector <double> getWhitePointxyY() const override; 0087 QVector <double> getEstimatedTRC() const override; 0088 virtual void LinearizeFloatValue(QVector <double> & Value) const; 0089 virtual void DelinearizeFloatValue(QVector <double> & Value) const; 0090 virtual void LinearizeFloatValueFast(QVector <double> & Value) const; 0091 virtual void DelinearizeFloatValueFast(QVector <double> & Value) const; 0092 QString name() const override; 0093 QString info() const override; 0094 QByteArray getProfileUniqueId() const override; 0095 0096 bool compareTRC(TransferCharacteristics characteristics, float error) const override; 0097 0098 static cmsToneCurve* transferFunction(TransferCharacteristics transferFunction); 0099 0100 protected: 0101 LcmsColorProfileContainer(); 0102 0103 private: 0104 bool init(); 0105 0106 class Private; 0107 Private *const d; 0108 }; 0109 0110 #endif // _KO_LCMS_COLORPROFILE_H 0111