10#include <klocalizedstring.h>
60 void transform(
const quint8 *src, quint8 *dst, qint32 numPixels)
const override
64 cmsDoTransform(
m_transform,
const_cast<quint8 *
>(src), dst, numPixels);
79 bool bpcFirstTransform,
81 ConversionFlags displayConversionFlags
90 bool doBPC1 = bpcFirstTransform;
104 quint16 alarm[cmsMAXCHANNELS];
105 alarm[0] = (cmsUInt16Number)gamutWarning[2]*256;
106 alarm[1] = (cmsUInt16Number)gamutWarning[1]*256;
107 alarm[2] = (cmsUInt16Number)gamutWarning[0]*256;
108 cmsSetAlarmCodes(alarm);
115 cmsHPROFILE profiles[] = {srcProfile->
lcmsProfile(),
119 cmsBool bpc[] = {doBPC1, doBPC1, doBPC2, doBPC2};
122 cmsFloat64Number adaptation[] = {adaptationState, adaptationState, adaptationState, adaptationState};
123 m_transform = cmsCreateExtendedTransform(cmsGetProfileContextID(srcProfile->
lcmsProfile()), 4, profiles, bpc, intents, adaptation, proof, 1, srcColorSpaceType, dstColorSpaceType, displayConversionFlags);
135 void transform(
const quint8 *src, quint8 *dst, qint32 numPixels)
const override
139 cmsDoTransform(
m_transform,
const_cast<quint8 *
>(src), dst, numPixels);
163 Q_CHECK_PTR(profile);
170 if (!profile->
valid()) {
171 cmsHPROFILE cmsp = cmsOpenProfileFromFile(filename.toLatin1(),
"r");
177 if (profile->
valid()) {
194 Q_CHECK_PTR(profile);
196 if (profile->
valid()) {
228 Q_CHECK_PTR(profile);
230 if (profile->
valid()) {
247 Q_CHECK_PTR(profile);
258 KoColorConversionTransformation::ConversionFlags conversionFlags)
const
276 bool firstTransformBPC,
277 quint8 *gamutWarning,
278 KoColorConversionTransformation::ConversionFlags displayConversionFlags)
const
288 dynamic_cast<const IccColorProfile *
>(dstColorSpace->
profile())->
asLcms(), proofingSpace, renderingIntent, proofingIntent, firstTransformBPC, gamutWarning,
289 displayConversionFlags
298 return lcmsInfo->colorSpaceType();
306 depthType = BYTES_SH(1);
308 depthType = BYTES_SH(2);
310 depthType = BYTES_SH(2) | FLOAT_SH(1);
312 depthType = BYTES_SH(4) | FLOAT_SH(1);
314 depthType = BYTES_SH(0) | FLOAT_SH(1);
316 qWarning() <<
"Unknown bit depth";
320 quint32 modelType = 0;
323 if (depthId.startsWith(QLatin1Char(
'U'))) {
324 modelType = (COLORSPACE_SH(PT_RGB) | EXTRA_SH(1) | CHANNELS_SH(3) | DOSWAP_SH(1) | SWAPFIRST_SH(1));
325 }
else if (depthId.startsWith(QLatin1Char(
'F'))) {
326 modelType = (COLORSPACE_SH(PT_RGB) | EXTRA_SH(1) | CHANNELS_SH(3));
329 modelType = (COLORSPACE_SH(PT_XYZ) | EXTRA_SH(1) | CHANNELS_SH(3));
331 modelType = (COLORSPACE_SH(PT_Lab) | EXTRA_SH(1) | CHANNELS_SH(3));
333 modelType = (COLORSPACE_SH(PT_CMYK) | EXTRA_SH(1) | CHANNELS_SH(4));
335 modelType = (COLORSPACE_SH(PT_GRAY) | EXTRA_SH(1) | CHANNELS_SH(1));
337 modelType = (COLORSPACE_SH(PT_GRAY) | CHANNELS_SH(1));
339 modelType = (COLORSPACE_SH(PT_YCbCr) | EXTRA_SH(1) | CHANNELS_SH(3));
341 qWarning() <<
"Cannot convert colorspace to lcms modeltype";
344 return depthType | modelType;
350 Q_UNUSED(colorDepthId);
351 return colorModelId !=
RGBAColorModelID.
id() || !profile || profile->
name() !=
"High Dynamic Range UHDTV Wide Color Gamut Display (Rec. 2020) - SMPTE ST 2084 PQ EOTF";
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID YCbCrAColorModelID("YCbCrA", ki18n("YCbCr/Alpha"))
const KoID Float64BitsColorDepthID("F64", ki18n("64-bit float/channel"))
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale/Alpha"))
const KoID XYZAColorModelID("XYZA", ki18n("XYZ/Alpha"))
const KoID Float16BitsColorDepthID("F16", ki18n("16-bit float/channel"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID CMYKAColorModelID("CMYKA", ki18n("CMYK/Alpha"))
const KoID LABAColorModelID("LABA", ki18n("L*a*b*/Alpha"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
const KoID GrayColorModelID("GRAY", ki18n("Grayscale (without transparency)"))
ColorPrimaries
The colorPrimaries enum Enum of colorants, follows ITU H.273 for values 0 to 255, and has extra known...
@ PRIMARIES_ITU_R_BT_2020_2_AND_2100_0
@ PRIMARIES_ITU_R_BT_709_5
TransferCharacteristics
The transferCharacteristics enum Enum of transfer characteristics, follows ITU H.273 for values 0 to ...
LcmsColorProfileContainer * asLcms() const
~IccColorSpaceEngine() override
KoColorConversionTransformation * createColorTransformation(const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::ConversionFlags conversionFlags) const override
void removeProfile(const QString &filename) override
KoColorProofingConversionTransformation * createColorProofingTransformation(const KoColorSpace *srcColorSpace, const KoColorSpace *dstColorSpace, const KoColorSpace *proofingSpace, KoColorConversionTransformation::Intent renderingIntent, KoColorConversionTransformation::Intent proofingIntent, bool firstTransformBPC, quint8 *gamutWarning, KoColorConversionTransformation::ConversionFlags displayConversionFlags) const override
bool supportsColorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile) const override
quint32 computeColorSpaceType(const KoColorSpace *cs) const
const KoColorProfile * getProfile(const QVector< double > &colorants, ColorPrimaries colorPrimaries, TransferCharacteristics transferFunction) override
getProfile This tries to generate a profile with the given characteristics and add it to the registry...
const KoColorProfile * addProfile(const QString &filename) override
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
virtual const KoColorProfile * profile() const =0
cmsHPROFILE lcmsProfile() const
static IccColorProfile * createFromLcmsProfile(const cmsHPROFILE profile)
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define INTENT_RELATIVE_COLORIMETRIC
virtual bool valid() const =0
const KoColorProfile * profileByName(const QString &name) const
static KoColorSpaceRegistry * instance()
void removeProfile(KoColorProfile *profile)
void addProfile(KoColorProfile *profile)