"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libs/pigment/KoColorProfile.cpp" between
krita-5.1.3.tar.xz and krita-5.1.4.tar.xz

About: Krita is a painting program offering art tools for everyone (concept art, texture and matte painters, illustrations and comics).

KoColorProfile.cpp  (krita-5.1.3.tar.xz):KoColorProfile.cpp  (krita-5.1.4.tar.xz)
/* /*
* SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net> * SPDX-FileCopyrightText: 2007 Cyrille Berger <cberger@cberger.net>
* *
* SPDX-License-Identifier: LGPL-2.1-or-later * SPDX-License-Identifier: LGPL-2.1-or-later
*/ */
#include <algorithm>
#include <array>
#include <cmath> #include <cmath>
#include "KoColorProfile.h" #include "KoColorProfile.h"
#include "DebugPigment.h" #include "DebugPigment.h"
#include "kis_assert.h" #include "kis_assert.h"
struct Q_DECL_HIDDEN KoColorProfile::Private { struct Q_DECL_HIDDEN KoColorProfile::Private {
QString name; QString name;
QString info; QString info;
QString fileName; QString fileName;
skipping to change at line 257 skipping to change at line 259
colorants.append({0.639998686, 0.330010138}); colorants.append({0.639998686, 0.330010138});
colorants.append({0.300003784, 0.600003357}); colorants.append({0.300003784, 0.600003357});
colorants.append({0.150002046, 0.059997204}); colorants.append({0.150002046, 0.059997204});
break; break;
} }
} }
TransferCharacteristics KoColorProfile::getTransferCharacteristics() const TransferCharacteristics KoColorProfile::getTransferCharacteristics() const
{ {
// Parse from an estimated gamma
const QVector<double> estimatedTRC = getEstimatedTRC();
const double error = 0.0001;
// Make sure the TRC is uniform across all channels
const bool isUniformTRC = (estimatedTRC[0] == estimatedTRC[1] && estimatedTR
C[0] == estimatedTRC[2]);
if (d->characteristics == TRC_UNSPECIFIED && isUniformTRC && hasTRC()) {
if (isLinear()) {
d->characteristics = TRC_LINEAR;
} else if (std::fabs(estimatedTRC[0] - (461.0 / 256.0)) < error) {
// ICC v2 u8Fixed8Number calculation
// Or can be prequantized as 1.80078125, courtesy of Elle Stone
d->characteristics = TRC_GAMMA_1_8;
} else if (std::fabs(estimatedTRC[0] - (563.0 / 256.0)) < error) {
// Or can be prequantized as 2.19921875, courtesy of Elle Stone
d->characteristics = TRC_A98;
} else if (std::fabs(estimatedTRC[0] - 1.8) < error) {
d->characteristics = TRC_GAMMA_1_8;
} else if (std::fabs(estimatedTRC[0] - 2.2) < error) {
d->characteristics = TRC_ITU_R_BT_470_6_SYSTEM_M;
} else if (std::fabs(estimatedTRC[0] - 2.4) < error) {
d->characteristics = TRC_GAMMA_2_4;
} else if (std::fabs(estimatedTRC[0] - 2.8) < error) {
d->characteristics = TRC_ITU_R_BT_470_6_SYSTEM_B_G;
} else {
// Escort to curve matching if no gamma is matched
static constexpr std::array<TransferCharacteristics, 12> trcList = {
{TRC_ITU_R_BT_709_5,
TRC_ITU_R_BT_470_6_SYSTEM_M,
TRC_ITU_R_BT_470_6_SYSTEM_B_G,
TRC_SMPTE_240M,
TRC_IEC_61966_2_1,
TRC_LOGARITHMIC_100,
TRC_LOGARITHMIC_100_sqrt10,
TRC_PROPHOTO,
TRC_GAMMA_1_8,
TRC_GAMMA_2_4,
TRC_A98,
TRC_LAB_L}};
const auto characteristic =
std::find_if(trcList.begin(), trcList.end(), [&](const TransferC
haracteristics &check) -> bool {
return compareTRC(check, static_cast<float>(error));
});
if (characteristic != trcList.end()) {
d->characteristics = *characteristic;
}
}
}
return d->characteristics; return d->characteristics;
} }
void KoColorProfile::setCharacteristics(ColorPrimaries primaries, TransferCharac teristics curve) void KoColorProfile::setCharacteristics(ColorPrimaries primaries, TransferCharac teristics curve)
{ {
d->primaries = int(primaries); d->primaries = int(primaries);
d->characteristics = curve; d->characteristics = curve;
} }
QString KoColorProfile::getTransferCharacteristicName(TransferCharacteristics cu rve) QString KoColorProfile::getTransferCharacteristicName(TransferCharacteristics cu rve)
skipping to change at line 306 skipping to change at line 354
case TRC_ITU_R_BT_2100_0_HLG: case TRC_ITU_R_BT_2100_0_HLG:
return QString("Hybrid Log Gamma"); return QString("Hybrid Log Gamma");
case TRC_GAMMA_1_8: case TRC_GAMMA_1_8:
return QString("Gamma 1.8"); return QString("Gamma 1.8");
case TRC_GAMMA_2_4: case TRC_GAMMA_2_4:
return QString("Gamma 2.4"); return QString("Gamma 2.4");
case TRC_A98: case TRC_A98:
return QString("Gamma A98"); return QString("Gamma A98");
case TRC_PROPHOTO: case TRC_PROPHOTO:
return QString("ProPhoto trc"); return QString("ProPhoto trc");
case TRC_LAB_L:
return QString("Lab L* trc");
case TRC_UNSPECIFIED: case TRC_UNSPECIFIED:
break; break;
} }
return QString("Unspecified"); return QString("Unspecified");
} }
void KoColorProfile::setName(const QString &name) void KoColorProfile::setName(const QString &name)
{ {
d->name = name; d->name = name;
 End of changes. 3 change blocks. 
0 lines changed or deleted 64 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)