Krita Source Code Documentation
Loading...
Searching...
No Matches
IccColorProfile Class Reference

#include <IccColorProfile.h>

+ Inheritance diagram for IccColorProfile:

Classes

class  Container
 
class  Data
 
struct  Private
 

Public Member Functions

LcmsColorProfileContainerasLcms () const
 
KoColorProfileclone () const override
 
QString colorModelID () const override
 
bool compareTRC (TransferCharacteristics characteristics, float error) const override
 
void delinearizeFloatValue (QVector< qreal > &Value) const override
 
void delinearizeFloatValueFast (QVector< qreal > &Value) const override
 
QVector< KoColorimetryUtils::xyYgetColorantsxyY () const override
 
QVector< KoColorimetryUtils::XYZgetColorantsXYZ () const override
 
QVector< qreal > getEstimatedTRC () const override
 
const QVector< KoChannelInfo::DoubleRange > & getFloatUIMinMax (void) const
 
KoColorimetryUtils::xyY getWhitePointxyY () const override
 
KoColorimetryUtils::XYZ getWhitePointXYZ () const override
 
bool hasColorants () const override
 
bool hasTRC () const override
 
 IccColorProfile (const IccColorProfile &rhs)
 
 IccColorProfile (const KoColorProfileQuery &query)
 
 IccColorProfile (const QByteArray &rawData)
 
 IccColorProfile (const QString &fileName=QString())
 
bool isLinear () const override
 
bool isSuitableForDisplay () const override
 
bool isSuitableForInput () const override
 
bool isSuitableForOutput () const override
 
bool isSuitableForPrinting () const override
 
bool isSuitableForWorkspace () const override
 
void linearizeFloatValue (QVector< qreal > &Value) const override
 
void linearizeFloatValueFast (QVector< qreal > &Value) const override
 
bool load () override
 
bool operator== (const KoColorProfile &) const override
 
QByteArray rawData () const override
 
virtual bool save ()
 
virtual bool save (const QString &fileName)
 
bool supportsAbsolute () const override
 
bool supportsPerceptual () const override
 
bool supportsRelative () const override
 
bool supportsSaturation () const override
 
QString type () const override
 
QByteArray uniqueId () const override
 
bool valid () const override
 
float version () const override
 
 ~IccColorProfile () override
 
- Public Member Functions inherited from KoColorProfile
QString copyright () const
 
QString fileName () const
 
virtual ColorPrimaries getColorPrimaries () const
 getColorPrimaries
 
virtual TransferCharacteristics getTransferCharacteristics () const
 getTransferCharacteristics This function should be subclassed at some point so we can get the value from the lcms profile.
 
QString info () const
 
 KoColorProfile (const KoColorProfile &profile)
 
 KoColorProfile (const QString &fileName=QString())
 
QString manufacturer () const
 
QString name () const
 
void setFileName (const QString &filename)
 
virtual ~KoColorProfile ()
 
- Public Member Functions inherited from Private
 Private (KisCanvas2 *c)
 

Protected Member Functions

bool init ()
 
void setRawData (const QByteArray &rawData)
 
- Protected Member Functions inherited from KoColorProfile
void setCharacteristics (ColorPrimaries primaries, TransferCharacteristics curve)
 setCharacteristics ideally, we'd read this from the icc profile curve, but that can be tricky, instead we'll set it on profile creation.
 
void setCopyright (const QString &copyright)
 
void setInfo (const QString &info)
 
void setManufacturer (const QString &manufacturer)
 
void setName (const QString &name)
 

Private Attributes

QScopedPointer< Privated
 

Additional Inherited Members

- Static Public Member Functions inherited from KoColorProfile
static void colorantsForType (ColorPrimaries primaries, KoColorimetryUtils::xy &whitePoint, QList< KoColorimetryUtils::xy > &colorants, const bool prequantized=false)
 colorantsForPrimaries fills a QVector<float> with the xy values of the whitepoint and red, green, blue colorants for a given predefined value. Will not change the vector when the primaries are set to 'undefined'.
 
static QString getColorPrimariesName (ColorPrimaries primaries)
 getColorPrimariesName
 
static QString getTransferCharacteristicName (TransferCharacteristics curve)
 getTransferCharacteristicName
 
- Public Attributes inherited from KoColorProfile
TransferCharacteristics characteristics {TRC_UNSPECIFIED}
 
QString copyright
 
QString fileName
 
QString info
 
QString manufacturer
 
QString name
 
int primaries {-1}
 
- Public Attributes inherited from Private
KisCanvas2canvas
 
int displayedFrame
 
int intendedFrame
 

Detailed Description

This class contains an ICC color profile.

Definition at line 22 of file IccColorProfile.h.

Constructor & Destructor Documentation

◆ IccColorProfile() [1/4]

IccColorProfile::IccColorProfile ( const QString & fileName = QString())
explicit

Definition at line 96 of file IccColorProfile.cpp.

98{
99}
QScopedPointer< Private > d
KoColorProfile(const QString &fileName=QString())

◆ IccColorProfile() [2/4]

IccColorProfile::IccColorProfile ( const QByteArray & rawData)
explicit

Definition at line 101 of file IccColorProfile.cpp.

102 : KoColorProfile(QString()), d(new Private)
103{
105 init();
106}
void setRawData(const QByteArray &rawData)
QByteArray rawData() const override

References init(), rawData(), and setRawData().

◆ IccColorProfile() [3/4]

IccColorProfile::IccColorProfile ( const KoColorProfileQuery & query)
explicit

Definition at line 108 of file IccColorProfile.cpp.

109: KoColorProfile(QString()), d(new Private)
110{
112
114
115 cmsCIExyY whitePoint;
116
117 QList<KoColorimetryUtils::xy> modifiedColorants = query.rgbColorants;
118
120
121 KoColorProfile::colorantsForType(query.primaries, wp, modifiedColorants, true);
122
123
124 if (modifiedColorants.size()>=2) {
125 whitePoint.x = wp.x;
126 whitePoint.y = wp.y;
127 whitePoint.Y = 1.0;
128 }
129
130 cmsToneCurve *mainCurve = LcmsColorProfileContainer::transferFunction(query.transfer);
131
132 cmsCIExyYTRIPLE primaries;
133
134 if (modifiedColorants.size()>0 && modifiedColorants.size() <= 3) {
135 primaries = {{modifiedColorants[0].x, modifiedColorants[0].y, 1.0},
136 {modifiedColorants[1].x, modifiedColorants[1].y, 1.0},
137 {modifiedColorants[2].x, modifiedColorants[2].y, 1.0}};
138 }
139
140 cmsHPROFILE iccProfile = nullptr;
141
142 if (query.isGrayscale()) {
143 iccProfile = cmsCreateGrayProfile(&whitePoint, mainCurve);
144 // cleanup
145 cmsFreeToneCurve(mainCurve);
146 } else /*if (colorants.size()>2 || colorPrimariesType != 2)*/ {
147 // generate rgb profile.
148 cmsToneCurve *curve[3];
149 curve[0] = curve[1] = curve[2] = mainCurve;
150 iccProfile = cmsCreateRGBProfile(&whitePoint, &primaries, curve);
151 cmsFreeToneCurve(mainCurve);
152 }
153
154 if (!iccProfile) {
155 qWarning() << "WARNING: LCMS failed to create a profile for the requested parameters";
156 qWarning().nospace() << " transfer function: " << getTransferCharacteristicName(query.transfer) << " (" << query.transfer << ")";
157 qWarning().nospace() << " named primaries:" << getColorPrimariesName(query.primaries) << " (" << query.primaries << ")";
158 qWarning() << " requested colorants:" << query.rgbColorants;
159 // leave the profile in invalid state and return
160 return;
161 }
162
164 name.append("Krita");
167 name.append(QStringLiteral("Rec. 2100"));
168 } else {
170 }
172
173 cmsCIEXYZ media_blackpoint = {0.0, 0.0, 0.0};
174 cmsWriteTag (iccProfile, cmsSigMediaBlackPointTag, &media_blackpoint);
175
176 if (query.transfer == TRC_ITU_R_BT_2100_0_PQ) {
177 double nits = 80.0;
181 // Otherwise this is recognised as a matrix shaper...
182 cmsWriteTag(iccProfile, cmsSigRedColorantTag, nullptr);
183 cmsWriteTag(iccProfile, cmsSigGreenColorantTag, nullptr);
184 cmsWriteTag(iccProfile, cmsSigBlueColorantTag, nullptr);
185 cmsWriteTag(iccProfile, cmsSigRedTRCTag, nullptr);
186 cmsWriteTag(iccProfile, cmsSigGreenTRCTag, nullptr);
187 cmsWriteTag(iccProfile, cmsSigBlueTRCTag, nullptr);
188
189 name.append("("+KisDomUtils::toString(nits)+"cd/m²)");
190
191 }
192
193 // we need to not write when primaries are unspecified, because otherwise kocolorprofile's own matching mechanism breaks.
194 if (query.primaries < 256 && query.primaries != PRIMARIES_UNSPECIFIED && query.transfer < 256) {
195 cmsVideoSignalType cicpValues;
196 cicpValues.ColourPrimaries = quint8(query.primaries);
197 cicpValues.TransferCharacteristics = quint8(query.transfer);
198 cicpValues.MatrixCoefficients = 0;
199 cicpValues.VideoFullRangeFlag = 0; // According to the H.273 spec, 0 is the default value.
200 cmsWriteTag (iccProfile, cmsSigcicpTag, &cicpValues);
201 }
202
203 //set the color profile info on the iccProfile;
204 cmsMLU *mlu;
205 mlu = cmsMLUalloc (NULL, 1);
206 cmsMLUsetWide(mlu, "en", "US", name.join(" ").toStdWString().data());
207 cmsWriteTag (iccProfile, cmsSigProfileDescriptionTag, mlu);
208 cmsMLUfree (mlu);
209 mlu = cmsMLUalloc (NULL, 1);
210 cmsMLUsetASCII (mlu, "en", "US", QString("Profile generated by Krita, Public domain.").toLatin1());
211 cmsWriteTag(iccProfile, cmsSigCopyrightTag, mlu);
212 cmsMLUfree (mlu);
213
214 // Still setting this, as it also writes the non H.273 values.
215 if (query.primaries != PRIMARIES_UNSPECIFIED) {
217 }
218
220 cmsCloseProfile(iccProfile);
221
222 setFileName(name.join(" ").remove("(").remove(")").replace("cd/m²", "nits").split(" ").join("-")+".icc");
223 init();
224}
@ PRIMARIES_ITU_R_BT_2020_2_AND_2100_0
@ PRIMARIES_UNSPECIFIED
@ TRC_ITU_R_BT_2100_0_HLG
@ TRC_ITU_R_BT_2100_0_PQ
static cmsToneCurve * transferFunction(TransferCharacteristics transferFunction)
static QByteArray lcmsProfileToByteArray(const cmsHPROFILE profile)
static bool setPerceptualQuantizerAToBDummyPipeline(cmsHPROFILE iccProfile, cmsTagSignature tag, ColorPrimaries primaries, double diffuseWhiteNits=80.0)
static bool setDiffuseWhitePerceptualQuantizer(cmsHPROFILE iccProfile, double diffuseWhiteNits=80.0)
setDiffuseWhitePerceptualQuantizer This adds a dictionary with an CRWL entry to the profile.
static bool setPerceptualQuantizerBToADummyPipeline(cmsHPROFILE iccProfile, cmsTagSignature tag, ColorPrimaries primaries, double diffuseWhiteNits=80.0)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
QString toString(const QString &value)
TransferCharacteristics transfer
CICP-compatible enum value representing the white point and primaries.
ColorPrimaries primaries
Rgb Primaries of the profile. When empty, this is a query for a greyscale profile.
bool isValid() const
CICP-compatible enum value representing the transfer function.
QList< KoColorimetryUtils::xy > rgbColorants
The desired white point of the profile.
KoColorimetryUtils::xy whitePoint
void setFileName(const QString &filename)
static QString getTransferCharacteristicName(TransferCharacteristics curve)
getTransferCharacteristicName
static QString getColorPrimariesName(ColorPrimaries primaries)
getColorPrimariesName
static void colorantsForType(ColorPrimaries primaries, KoColorimetryUtils::xy &whitePoint, QList< KoColorimetryUtils::xy > &colorants, const bool prequantized=false)
colorantsForPrimaries fills a QVector<float> with the xy values of the whitepoint and red,...
void setCharacteristics(ColorPrimaries primaries, TransferCharacteristics curve)
setCharacteristics ideally, we'd read this from the icc profile curve, but that can be tricky,...

References KoColorProfile::colorantsForType(), d, KoColorProfile::getColorPrimariesName(), KoColorProfile::getTransferCharacteristicName(), init(), KoColorProfileQuery::isGrayscale(), KoColorProfileQuery::isValid(), KIS_SAFE_ASSERT_RECOVER_RETURN, LcmsColorProfileContainer::lcmsProfileToByteArray(), KoColorProfile::name, KoColorProfile::primaries, KoColorProfileQuery::primaries, PRIMARIES_ITU_R_BT_2020_2_AND_2100_0, PRIMARIES_UNSPECIFIED, KoColorProfileQuery::rgbColorants, KoColorProfile::setCharacteristics(), LcmsPredefinedPipelineFunctions::setDiffuseWhitePerceptualQuantizer(), KoColorProfile::setFileName(), LcmsPredefinedPipelineFunctions::setPerceptualQuantizerAToBDummyPipeline(), LcmsPredefinedPipelineFunctions::setPerceptualQuantizerBToADummyPipeline(), setRawData(), KisDomUtils::toString(), KoColorProfileQuery::transfer, LcmsColorProfileContainer::transferFunction(), TRC_ITU_R_BT_2100_0_HLG, TRC_ITU_R_BT_2100_0_PQ, KoColorProfileQuery::whitePoint, KoColorimetryUtils::xy::x, and KoColorimetryUtils::xy::y.

◆ IccColorProfile() [4/4]

IccColorProfile::IccColorProfile ( const IccColorProfile & rhs)

Definition at line 226 of file IccColorProfile.cpp.

227 : KoColorProfile(rhs)
228 , d(new Private(*rhs.d))
229{
230 Q_ASSERT(d->shared);
231}

References d.

◆ ~IccColorProfile()

IccColorProfile::~IccColorProfile ( )
override

Definition at line 233 of file IccColorProfile.cpp.

234{
235 Q_ASSERT(d->shared);
236}

References d.

Member Function Documentation

◆ asLcms()

LcmsColorProfileContainer * IccColorProfile::asLcms ( ) const

Definition at line 505 of file IccColorProfile.cpp.

506{
507 Q_ASSERT(d->shared->lcmsProfile);
508 return d->shared->lcmsProfile.data();
509}

References d.

◆ clone()

KoColorProfile * IccColorProfile::clone ( ) const
overridevirtual

Create a copy of this profile. Data that shall not change during the life time of the profile shouldn't be duplicated but shared, like for instance ICC data.

Data that shall be changed like a palette or hdr information such as exposure must be duplicated while cloning.

Implements KoColorProfile.

Definition at line 238 of file IccColorProfile.cpp.

239{
240 return new IccColorProfile(*this);
241}
IccColorProfile(const QString &fileName=QString())

References IccColorProfile().

◆ colorModelID()

QString IccColorProfile::colorModelID ( ) const
overridevirtual
Returns
a string for a color model id.

Reimplemented from KoColorProfile.

Definition at line 268 of file IccColorProfile.cpp.

269{
270 QString model;
271
272 switch (d->shared->lcmsProfile->colorSpaceSignature()) {
273 case cmsSigRgbData:
274 model = "RGBA";
275 break;
276 case cmsSigLabData:
277 model = "LABA";
278 break;
279 case cmsSigCmykData:
280 model = "CMYKA";
281 break;
282 case cmsSigGrayData:
283 model = "GRAYA";
284 break;
285 case cmsSigXYZData:
286 model = "XYZA";
287 break;
288 case cmsSigYCbCrData:
289 model = "YCbCrA";
290 break;
291 default:
292 // In theory we should be able to interpret the colorspace signature as a 4 char array...
293 model = QString();
294 }
295
296 return model;
297}

References d.

◆ compareTRC()

bool IccColorProfile::compareTRC ( TransferCharacteristics characteristics,
float error ) const
overridevirtual

Comparing profile's TRC against the other with defined error threshold, returns true if profile TRC is matched.

Implements KoColorProfile.

Definition at line 423 of file IccColorProfile.cpp.

424{
425 if (d->shared->lcmsProfile) {
426 return d->shared->lcmsProfile->compareTRC(characteristics, error);
427 }
428 return false;
429}
TransferCharacteristics characteristics

References KoColorProfile::characteristics, and d.

◆ delinearizeFloatValue()

void IccColorProfile::delinearizeFloatValue ( QVector< qreal > & Value) const
overridevirtual

Delinearizes first 3 values of QVector, leaving other values unchanged. Returns the same QVector if it is not possible to delinearize. Effectively undoes LinearizeFloatValue.

Implements KoColorProfile.

Definition at line 436 of file IccColorProfile.cpp.

437{
438 if (d->shared->lcmsProfile)
439 d->shared->lcmsProfile->DelinearizeFloatValue(Value);
440}

References d.

◆ delinearizeFloatValueFast()

void IccColorProfile::delinearizeFloatValueFast ( QVector< qreal > & Value) const
overridevirtual

Implements KoColorProfile.

Definition at line 446 of file IccColorProfile.cpp.

447{
448 if (d->shared->lcmsProfile)
449 d->shared->lcmsProfile->DelinearizeFloatValueFast(Value);
450}

References d.

◆ getColorantsxyY()

QVector< KoColorimetryUtils::xyY > IccColorProfile::getColorantsxyY ( ) const
overridevirtual
Returns
a qvector <KoColorimetryUtils::xyY> with the colorants in xyY

Implements KoColorProfile.

Definition at line 391 of file IccColorProfile.cpp.

392{
393 if (d->shared->lcmsProfile) {
394 return d->shared->lcmsProfile->getColorantsxyY();
395 }
397}

References d.

◆ getColorantsXYZ()

QVector< KoColorimetryUtils::XYZ > IccColorProfile::getColorantsXYZ ( ) const
overridevirtual
Returns
a qvector <KoColorimetryUtils::XYZ> with the RGB colorants in XYZ

Implements KoColorProfile.

Definition at line 384 of file IccColorProfile.cpp.

385{
386 if (d->shared->lcmsProfile) {
387 return d->shared->lcmsProfile->getColorantsXYZ();
388 }
390}

References d.

◆ getEstimatedTRC()

QVector< qreal > IccColorProfile::getEstimatedTRC ( ) const
overridevirtual
Returns
estimated gamma for RGB and Grayscale profiles

Implements KoColorProfile.

Definition at line 413 of file IccColorProfile.cpp.

414{
415 QVector <qreal> dummy(3);
416 dummy.fill(2.2);//estimated sRGB trc.
417 if (d->shared->lcmsProfile) {
418 return d->shared->lcmsProfile->getEstimatedTRC();
419 }
420 return dummy;
421}

References d.

◆ getFloatUIMinMax()

const QVector< KoChannelInfo::DoubleRange > & IccColorProfile::getFloatUIMinMax ( void ) const

Returns the set of min/maxes for each channel in this profile. These (sometimes approximate) min and maxes are suitable for UI building. Furthermore, then only apply to the floating point uses of this profile, and not the integer variants.

Definition at line 520 of file IccColorProfile.cpp.

521{
522 Q_ASSERT(!d->shared->profileInfo->value.uiMinMaxes.isEmpty());
523 return d->shared->profileInfo->value.uiMinMaxes;
524}

References d.

◆ getWhitePointxyY()

KoColorimetryUtils::xyY IccColorProfile::getWhitePointxyY ( ) const
overridevirtual
Returns
a KoColorimetryUtils::xyY with the whitepoint in xyY

Implements KoColorProfile.

Definition at line 406 of file IccColorProfile.cpp.

407{
408 if (d->shared->lcmsProfile) {
409 return d->shared->lcmsProfile->getWhitePointxyY();
410 }
411 return KoColorimetryUtils::xyY{0.34773, 0.35952, 1.0};
412}

References d.

◆ getWhitePointXYZ()

KoColorimetryUtils::XYZ IccColorProfile::getWhitePointXYZ ( ) const
overridevirtual
Returns
a KoColorimetryUtils::XYZ with the whitepoint in XYZ

Implements KoColorProfile.

Definition at line 398 of file IccColorProfile.cpp.

399{
400 KoColorimetryUtils::XYZ d50Dummy {0.9642, 1.0000, 0.8249};
401 if (d->shared->lcmsProfile) {
402 return d->shared->lcmsProfile->getWhitePointXYZ();
403 }
404 return d50Dummy;
405}

References d.

◆ hasColorants()

bool IccColorProfile::hasColorants ( ) const
overridevirtual
Returns
if the profile has colorants.

Implements KoColorProfile.

Definition at line 365 of file IccColorProfile.cpp.

366{
367 if (d->shared->lcmsProfile) {
368 return d->shared->lcmsProfile->hasColorants();
369 }
370 return false;
371}

References d.

◆ hasTRC()

bool IccColorProfile::hasTRC ( ) const
overridevirtual
Returns
if the profile has a TRC(required for linearisation).

Implements KoColorProfile.

Definition at line 372 of file IccColorProfile.cpp.

373{
374 if (d->shared->lcmsProfile)
375 return d->shared->lcmsProfile->hasTRC();
376 return false;
377}

References d.

◆ init()

bool IccColorProfile::init ( )
protected

Definition at line 481 of file IccColorProfile.cpp.

482{
483 if (!d->shared->lcmsProfile) {
484 d->shared->lcmsProfile.reset(new LcmsColorProfileContainer(d->shared->data.data()));
485 }
486 if (d->shared->lcmsProfile->init()) {
487 setName(d->shared->lcmsProfile->name());
488 setInfo(d->shared->lcmsProfile->info());
489 setManufacturer(d->shared->lcmsProfile->manufacturer());
490 setCopyright(d->shared->lcmsProfile->copyright());
491 if (d->shared->lcmsProfile->hasCicpValues()) {
492 setCharacteristics(d->shared->lcmsProfile->cicpPrimaries(), d->shared->lcmsProfile->cicpTransfer());
493 }
494 if (d->shared->lcmsProfile->valid()) {
495 d->shared->profileInfo = Private::LazyProfileInfo([this] () {
496 return d->calculateFloatUIMinMax();
497 });
498 }
499 return true;
500 } else {
501 return false;
502 }
503}
KisLazyStorage< KisLazyValueWrapper< ProfileInfo >, std::function< ProfileInfo()> > LazyProfileInfo
void setCopyright(const QString &copyright)
void setName(const QString &name)
void setManufacturer(const QString &manufacturer)
void setInfo(const QString &info)

References d, KoColorProfile::setCharacteristics(), KoColorProfile::setCopyright(), KoColorProfile::setInfo(), KoColorProfile::setManufacturer(), and KoColorProfile::setName().

◆ isLinear()

bool IccColorProfile::isLinear ( ) const
overridevirtual
Returns
if the profile's TRCs are linear.

Implements KoColorProfile.

Definition at line 378 of file IccColorProfile.cpp.

379{
380 if (d->shared->lcmsProfile)
381 return d->shared->lcmsProfile->isLinear();
382 return false;
383}

References d.

◆ isSuitableForDisplay()

bool IccColorProfile::isSuitableForDisplay ( ) const
overridevirtual
Returns
true if this profile is suitable to use for display

Implements KoColorProfile.

Definition at line 329 of file IccColorProfile.cpp.

330{
331 if (d->shared->lcmsProfile) {
332 return d->shared->lcmsProfile->isSuitableForDisplay();
333 }
334 return false;
335}

References d.

◆ isSuitableForInput()

bool IccColorProfile::isSuitableForInput ( ) const
overridevirtual
Returns
true if this profile can be used to convert color from this one to a different one

Implements KoColorProfile.

Definition at line 305 of file IccColorProfile.cpp.

306{
307 if (d->shared->lcmsProfile) {
308 return d->shared->lcmsProfile->isSuitableForInput() && d->shared->profileInfo->value.canCreateCyclicTransform;
309 }
310 return false;
311}

References d.

◆ isSuitableForOutput()

bool IccColorProfile::isSuitableForOutput ( ) const
overridevirtual
Returns
true if this profile can be used to convert color from a different profile to this one

Implements KoColorProfile.

Definition at line 298 of file IccColorProfile.cpp.

299{
300 if (d->shared->lcmsProfile) {
301 return d->shared->lcmsProfile->isSuitableForOutput() && d->shared->profileInfo->value.canCreateCyclicTransform;
302 }
303 return false;
304}

References d.

◆ isSuitableForPrinting()

bool IccColorProfile::isSuitableForPrinting ( ) const
overridevirtual
Returns
true if this profile is suitable to use for printing

Implements KoColorProfile.

Definition at line 321 of file IccColorProfile.cpp.

322{
323 if (d->shared->lcmsProfile) {
324 return d->shared->lcmsProfile->isSuitableForPrinting();
325 }
326 return false;
327}

References d.

◆ isSuitableForWorkspace()

bool IccColorProfile::isSuitableForWorkspace ( ) const
overridevirtual
Returns
true if you can use this profile can be used in Krita

Implements KoColorProfile.

Definition at line 312 of file IccColorProfile.cpp.

313{
314 if (d->shared->lcmsProfile) {
315 return d->shared->lcmsProfile->isSuitableForWorkspace() && d->shared->profileInfo->value.canCreateCyclicTransform;
316 }
317 return false;
318}

References d.

◆ linearizeFloatValue()

void IccColorProfile::linearizeFloatValue ( QVector< qreal > & Value) const
overridevirtual

Linearizes first 3 values of QVector, leaving other values unchanged. Returns the same QVector if it is not possible to linearize.

Implements KoColorProfile.

Definition at line 431 of file IccColorProfile.cpp.

432{
433 if (d->shared->lcmsProfile)
434 d->shared->lcmsProfile->LinearizeFloatValue(Value);
435}

References d.

◆ linearizeFloatValueFast()

void IccColorProfile::linearizeFloatValueFast ( QVector< qreal > & Value) const
overridevirtual

More imprecise versions of the above(limited to 16bit, and can't delinearize above 1.0.) Use this for filters and images.

Implements KoColorProfile.

Definition at line 441 of file IccColorProfile.cpp.

442{
443 if (d->shared->lcmsProfile)
444 d->shared->lcmsProfile->LinearizeFloatValueFast(Value);
445}

References d.

◆ load()

bool IccColorProfile::load ( )
overridevirtual

Load the profile in memory.

Returns
true if the profile has been successfully loaded

Reimplemented from KoColorProfile.

Definition at line 461 of file IccColorProfile.cpp.

462{
463 QFile file(fileName());
464 if (file.open(QIODevice::ReadOnly)) {
465 QByteArray rawData = file.readAll();
467 file.close();
468 if (init()) {
469 return true;
470 }
471 }
472 qWarning() << "Failed to load profile from " << fileName();
473 return false;
474}

References KoColorProfile::fileName, init(), rawData(), and setRawData().

◆ operator==()

bool IccColorProfile::operator== ( const KoColorProfile & rhs) const
overridevirtual

Implements KoColorProfile.

Definition at line 511 of file IccColorProfile.cpp.

512{
513 const IccColorProfile *rhsIcc = dynamic_cast<const IccColorProfile *>(&rhs);
514 if (rhsIcc) {
515 return d->shared == rhsIcc->d->shared;
516 }
517 return false;
518}

References d.

◆ rawData()

QByteArray IccColorProfile::rawData ( ) const
overridevirtual
Returns
an array with the raw data of the profile

Reimplemented from KoColorProfile.

Definition at line 243 of file IccColorProfile.cpp.

244{
245 return d->shared->data->rawData();
246}

References d.

◆ save() [1/2]

bool IccColorProfile::save ( )
virtual

Definition at line 476 of file IccColorProfile.cpp.

477{
478 return false;
479}

◆ save() [2/2]

bool KoColorProfile::save ( const QString & fileName)
virtual

Override this function to save the profile.

Parameters
fileNamedestination
Returns
true if the profile has been successfully saved

Reimplemented from KoColorProfile.

Definition at line 62 of file KoColorProfile.cpp.

47{
48 Q_UNUSED(filename);
49 return false;
50}

References KoColorProfile::d.

◆ setRawData()

void IccColorProfile::setRawData ( const QByteArray & rawData)
protected

Definition at line 248 of file IccColorProfile.cpp.

249{
250 d->shared->data->setRawData(rawData);
251}

References d, and rawData().

◆ supportsAbsolute()

bool IccColorProfile::supportsAbsolute ( ) const
overridevirtual

Implements KoColorProfile.

Definition at line 351 of file IccColorProfile.cpp.

352{
353 if (d->shared->lcmsProfile) {
354 return d->shared->lcmsProfile->supportsAbsolute();
355 }
356 return false;
357}

References d.

◆ supportsPerceptual()

bool IccColorProfile::supportsPerceptual ( ) const
overridevirtual
Returns
which rendering intents are supported

Implements KoColorProfile.

Definition at line 337 of file IccColorProfile.cpp.

338{
339 if (d->shared->lcmsProfile) {
340 return d->shared->lcmsProfile->supportsPerceptual();
341 }
342 return false;
343}

References d.

◆ supportsRelative()

bool IccColorProfile::supportsRelative ( ) const
overridevirtual

Implements KoColorProfile.

Definition at line 358 of file IccColorProfile.cpp.

359{
360 if (d->shared->lcmsProfile) {
361 return d->shared->lcmsProfile->supportsRelative();
362 }
363 return false;
364}

References d.

◆ supportsSaturation()

bool IccColorProfile::supportsSaturation ( ) const
overridevirtual

Implements KoColorProfile.

Definition at line 344 of file IccColorProfile.cpp.

345{
346 if (d->shared->lcmsProfile) {
347 return d->shared->lcmsProfile->supportsSaturation();
348 }
349 return false;
350}

References d.

◆ type()

QString IccColorProfile::type ( ) const
inlineoverridevirtual
Returns
the type of this profile (icc, ctlcs etc)

Reimplemented from KoColorProfile.

Definition at line 120 of file IccColorProfile.h.

121 {
122 return "icc";
123 }

◆ uniqueId()

QByteArray IccColorProfile::uniqueId ( ) const
overridevirtual

Implements KoColorProfile.

Definition at line 452 of file IccColorProfile.cpp.

453{
454 QByteArray dummy;
455 if (d->shared->lcmsProfile) {
456 dummy = d->shared->lcmsProfile->getProfileUniqueId();
457 }
458 return dummy;
459}

References d.

◆ valid()

bool IccColorProfile::valid ( ) const
overridevirtual
Returns
true if the profile is valid, false if it isn't been loaded in memory yet, or if the loaded memory is a bad profile

Implements KoColorProfile.

Definition at line 253 of file IccColorProfile.cpp.

254{
255 if (d->shared->lcmsProfile) {
256 return d->shared->lcmsProfile->valid();
257 }
258 return false;
259}

References d.

◆ version()

float IccColorProfile::version ( ) const
overridevirtual

Return version

Implements KoColorProfile.

Definition at line 260 of file IccColorProfile.cpp.

261{
262 if (d->shared->lcmsProfile) {
263 return d->shared->lcmsProfile->version();
264 }
265 return 0.0;
266}

References d.

Member Data Documentation

◆ d

QScopedPointer<Private> IccColorProfile::d
private

Definition at line 142 of file IccColorProfile.h.


The documentation for this class was generated from the following files: