10#include <klocalizedstring.h>
63 void transform(
const quint8 *src, quint8 *dst, qint32 numPixels)
const override
67 cmsDoTransform(
m_transform,
const_cast<quint8 *
>(src), dst, numPixels);
82 bool bpcFirstTransform,
84 ConversionFlags displayConversionFlags
93 bool doBPC1 = bpcFirstTransform;
107 quint16 alarm[cmsMAXCHANNELS];
108 alarm[0] = (cmsUInt16Number)gamutWarning[2]*256;
109 alarm[1] = (cmsUInt16Number)gamutWarning[1]*256;
110 alarm[2] = (cmsUInt16Number)gamutWarning[0]*256;
111 cmsSetAlarmCodes(alarm);
118 cmsHPROFILE profiles[] = {srcProfile->
lcmsProfile(),
122 cmsBool bpc[] = {doBPC1, doBPC1, doBPC2, doBPC2};
125 cmsFloat64Number adaptation[] = {adaptationState, adaptationState, adaptationState, adaptationState};
126 m_transform = cmsCreateExtendedTransform(cmsGetProfileContextID(srcProfile->
lcmsProfile()), 4, profiles, bpc, intents, adaptation, proof, 1, srcColorSpaceType, dstColorSpaceType, displayConversionFlags);
138 void transform(
const quint8 *src, quint8 *dst, qint32 numPixels)
const override
142 cmsDoTransform(
m_transform,
const_cast<quint8 *
>(src), dst, numPixels);
166 Q_CHECK_PTR(profile);
173 if (!profile->
valid()) {
174 cmsHPROFILE cmsp = cmsOpenProfileFromFile(filename.toLatin1(),
"r");
180 if (profile->
valid()) {
197 Q_CHECK_PTR(profile);
199 if (profile->
valid()) {
230 Q_CHECK_PTR(profile);
232 if (profile->
valid()) {
249 Q_CHECK_PTR(profile);
260 KoColorConversionTransformation::ConversionFlags conversionFlags)
const
278 bool firstTransformBPC,
279 quint8 *gamutWarning,
280 KoColorConversionTransformation::ConversionFlags displayConversionFlags)
const
290 dynamic_cast<const IccColorProfile *
>(dstColorSpace->
profile())->
asLcms(), proofingSpace, renderingIntent, proofingIntent, firstTransformBPC, gamutWarning,
291 displayConversionFlags
300 return lcmsInfo->colorSpaceType();
308 depthType = BYTES_SH(1);
310 depthType = BYTES_SH(2);
312 depthType = BYTES_SH(2) | FLOAT_SH(1);
314 depthType = BYTES_SH(4) | FLOAT_SH(1);
316 depthType = BYTES_SH(0) | FLOAT_SH(1);
318 qWarning() <<
"Unknown bit depth";
322 quint32 modelType = 0;
325 if (depthId.startsWith(QLatin1Char(
'U'))) {
326 modelType = (COLORSPACE_SH(PT_RGB) | EXTRA_SH(1) | CHANNELS_SH(3) | DOSWAP_SH(1) | SWAPFIRST_SH(1));
327 }
else if (depthId.startsWith(QLatin1Char(
'F'))) {
328 modelType = (COLORSPACE_SH(PT_RGB) | EXTRA_SH(1) | CHANNELS_SH(3));
331 modelType = (COLORSPACE_SH(PT_XYZ) | EXTRA_SH(1) | CHANNELS_SH(3));
333 modelType = (COLORSPACE_SH(PT_Lab) | EXTRA_SH(1) | CHANNELS_SH(3));
335 modelType = (COLORSPACE_SH(PT_CMYK) | EXTRA_SH(1) | CHANNELS_SH(4));
337 modelType = (COLORSPACE_SH(PT_GRAY) | EXTRA_SH(1) | CHANNELS_SH(1));
339 modelType = (COLORSPACE_SH(PT_GRAY) | CHANNELS_SH(1));
341 modelType = (COLORSPACE_SH(PT_YCbCr) | EXTRA_SH(1) | CHANNELS_SH(3));
343 qWarning() <<
"Cannot convert colorspace to lcms modeltype";
346 return depthType | modelType;
352 Q_UNUSED(colorDepthId);
356 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)"))
@ PRIMARIES_ITU_R_BT_2020_2_AND_2100_0
@ PRIMARIES_ITU_R_BT_709_5
LcmsColorProfileContainer * asLcms() const
const KoColorProfile * getProfile(const KoColorProfileQuery &query) override
getProfile This tries to generate a profile with the given characteristics and add it to the registry...
~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 * 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
The KoColorProfileQuery struct.
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.
virtual bool valid() const =0
virtual TransferCharacteristics getTransferCharacteristics() const
getTransferCharacteristics This function should be subclassed at some point so we can get the value f...
const KoColorProfile * profileByName(const QString &name) const
static KoColorSpaceRegistry * instance()
void removeProfile(KoColorProfile *profile)
void addProfile(KoColorProfile *profile)