Warning, file /office/calligra/libs/pigment/KoColorProfile.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) 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_COLOR_PROFILE_H_ 0021 #define _KO_COLOR_PROFILE_H_ 0022 0023 #include <QString> 0024 #include <QVector> 0025 #include <QVariant> 0026 0027 #include "pigment_export.h" 0028 0029 /** 0030 * Contains information needed for color transformation. 0031 */ 0032 class PIGMENTCMS_EXPORT KoColorProfile 0033 { 0034 0035 public: 0036 0037 /** 0038 * @param fileName file name to load or save that profile 0039 */ 0040 explicit KoColorProfile(const QString &fileName = QString()); 0041 KoColorProfile(const KoColorProfile& profile); 0042 virtual ~KoColorProfile(); 0043 0044 /** 0045 * @return the type of this profile (icc, ctlcs etc) 0046 */ 0047 virtual QString type() const { 0048 return QString(); 0049 } 0050 0051 /** 0052 * Create a copy of this profile. 0053 * Data that shall not change during the life time of the profile shouldn't be 0054 * duplicated but shared, like for instance ICC data. 0055 * 0056 * Data that shall be changed like a palette or hdr information such as exposure 0057 * must be duplicated while cloning. 0058 */ 0059 virtual KoColorProfile* clone() const = 0; 0060 0061 /** 0062 * Load the profile in memory. 0063 * @return true if the profile has been successfully loaded 0064 */ 0065 virtual bool load(); 0066 0067 /** 0068 * Override this function to save the profile. 0069 * @param fileName destination 0070 * @return true if the profile has been successfully saved 0071 */ 0072 virtual bool save(const QString &fileName); 0073 0074 /** 0075 * @return true if the profile is valid, false if it isn't been loaded in memory yet, or 0076 * if the loaded memory is a bad profile 0077 */ 0078 virtual bool valid() const = 0; 0079 0080 /** 0081 * @return the name of this profile 0082 */ 0083 QString name() const; 0084 /** 0085 * @return the info of this profile 0086 */ 0087 QString info() const; 0088 /** @return manufacturer of the profile 0089 */ 0090 QString manufacturer() const; 0091 /** 0092 * @return the copyright of the profile 0093 */ 0094 QString copyright() const; 0095 /** 0096 * @return the filename of the profile (it might be empty) 0097 */ 0098 QString fileName() const; 0099 /** 0100 * @param filename new filename 0101 */ 0102 void setFileName(const QString &filename); 0103 0104 /** 0105 * Return version 0106 */ 0107 virtual float version() const = 0; 0108 /** 0109 * @return true if you can use this profile can be used to convert color from a different 0110 * profile to this one 0111 */ 0112 virtual bool isSuitableForOutput() const = 0; 0113 /** 0114 * @return true if this profile is suitable to use for printing 0115 */ 0116 virtual bool isSuitableForPrinting() const = 0; 0117 /** 0118 * @return true if this profile is suitable to use for display 0119 */ 0120 virtual bool isSuitableForDisplay() const = 0; 0121 0122 /** 0123 * @return which rendering intents are supported 0124 */ 0125 virtual bool supportsPerceptual() const = 0; 0126 virtual bool supportsSaturation() const = 0; 0127 virtual bool supportsAbsolute() const = 0; 0128 virtual bool supportsRelative() const = 0; 0129 /** 0130 * @return if the profile has colorants. 0131 */ 0132 virtual bool hasColorants() const = 0; 0133 /** 0134 * @return a qvector <double>(9) with the RGB colorants in XYZ 0135 */ 0136 virtual QVector <qreal> getColorantsXYZ() const = 0; 0137 /** 0138 * @return a qvector <double>(9) with the RGB colorants in xyY 0139 */ 0140 virtual QVector <qreal> getColorantsxyY() const = 0; 0141 /** 0142 * @return a qvector <double>(3) with the whitepoint in XYZ 0143 */ 0144 virtual QVector <qreal> getWhitePointXYZ() const = 0; 0145 /** 0146 * @return a qvector <double>(3) with the whitepoint in xyY 0147 */ 0148 virtual QVector <qreal> getWhitePointxyY() const = 0; 0149 0150 /** 0151 * @return estimated gamma for RGB and Grayscale profiles 0152 */ 0153 virtual QVector <qreal> getEstimatedTRC() const = 0; 0154 0155 /** 0156 * @return if the profile has a TRC(required for linearisation). 0157 */ 0158 virtual bool hasTRC() const = 0; 0159 /** 0160 * Linearizes first 3 values of QVector, leaving other values unchanged. 0161 * Returns the same QVector if it is not possible to linearize. 0162 */ 0163 virtual void linearizeFloatValue(QVector <qreal> & Value) const = 0; 0164 /** 0165 * Delinearizes first 3 values of QVector, leaving other values unchanged. 0166 * Returns the same QVector if it is not possible to delinearize. 0167 * Effectively undoes LinearizeFloatValue. 0168 */ 0169 virtual void delinearizeFloatValue(QVector <qreal> & Value) const = 0; 0170 /** 0171 * More imprecise versions of the above(limited to 16bit, and can't 0172 * delinearize above 1.0.) Use this for filters and images. 0173 */ 0174 virtual void linearizeFloatValueFast(QVector <qreal> & Value) const = 0; 0175 virtual void delinearizeFloatValueFast(QVector <qreal> & Value) const = 0; 0176 0177 virtual bool operator==(const KoColorProfile&) const = 0; 0178 0179 /** 0180 * @return an array with the raw data of the profile 0181 */ 0182 virtual QByteArray rawData() const { 0183 return QByteArray(); 0184 } 0185 0186 protected: 0187 /** 0188 * Allows to define the name of this profile. 0189 */ 0190 void setName(const QString &name); 0191 /** 0192 * Allows to set the information string of that profile. 0193 */ 0194 void setInfo(const QString &info); 0195 /** 0196 * Allows to set the manufacturer string of that profile. 0197 */ 0198 void setManufacturer(const QString &manufacturer); 0199 /** 0200 * Allows to set the copyright string of that profile. 0201 */ 0202 void setCopyright(const QString ©right); 0203 0204 private: 0205 struct Private; 0206 Private* const d; 0207 }; 0208 0209 #endif