IccProfile DMetadata::getIccProfile() const { // Check if Exif data contains an ICC color profile. QByteArray data = getExifTagData("Exif.Image.InterColorProfile"); if (!data.isNull()) { qCDebug(DIGIKAM_METAENGINE_LOG) << "Found an ICC profile in Exif metadata"; return IccProfile(data); } // Else check the Exif color-space tag and use default profiles that we ship switch (getItemColorWorkSpace()) { case DMetadata::WORKSPACE_SRGB: { qCDebug(DIGIKAM_METAENGINE_LOG) << "Exif color-space tag is sRGB. Using default sRGB ICC profile."; return IccProfile::sRGB(); } case DMetadata::WORKSPACE_ADOBERGB: { qCDebug(DIGIKAM_METAENGINE_LOG) << "Exif color-space tag is AdobeRGB. Using default AdobeRGB ICC profile."; return IccProfile::adobeRGB(); } default: break; } return IccProfile(); }
void SoftProofDialog::readSettings() { ICCSettingsContainer settings = IccSettings::instance()->settings(); d->deviceProfileBox->setCurrentProfile(IccProfile(settings.defaultProofProfile)); d->proofingIntentBox->setIntent(settings.proofingRenderingIntent); d->gamutCheckBox->setChecked(settings.doGamutCheck); d->maskColorBtn->setColor(settings.gamutCheckMaskColor); }
bool DMetadata::setIccProfile(const IccProfile& profile) { if (profile.isNull()) { removeExifTag("Exif.Image.InterColorProfile"); } else { QByteArray data = IccProfile(profile).data(); if (!setExifTagData("Exif.Image.InterColorProfile", data)) { return false; } } removeExifColorSpace(); return true; }
/* * From koffice/libs/pigment/colorprofiles/KoLcmsColorProfileContainer.cpp * Copyright (C) 2000 Matthias Elter <*****@*****.**> * 2001 John Califf * 2004 Boudewijn Rempt <*****@*****.**> * Copyright (C) 2007 Thomas Zander <*****@*****.**> * Copyright (C) 2007 Adrian Page <*****@*****.**>IccProfile IccSettingsPriv::profileForScreen(QWidget *widget) */ IccProfile IccSettings::IccSettingsPriv::profileFromWindowSystem(QWidget* widget) { #ifdef Q_WS_X11 Qt::HANDLE appRootWindow; QString atomName; QDesktopWidget* desktop = QApplication::desktop(); int screenNumber = desktop->screenNumber(widget); IccProfile profile; { QMutexLocker lock(&mutex); if (screenProfiles.contains(screenNumber)) { return screenProfiles.value(screenNumber); } } if (desktop->isVirtualDesktop()) { appRootWindow = QX11Info::appRootWindow(QX11Info::appScreen()); atomName = QString("_ICC_PROFILE_%1").arg(screenNumber); } else { appRootWindow = QX11Info::appRootWindow(screenNumber); atomName = "_ICC_PROFILE"; } Atom type; int format; unsigned long nitems; unsigned long bytes_after; quint8* str; static Atom icc_atom = XInternAtom( QX11Info::display(), atomName.toLatin1(), True ); if ( icc_atom != None && XGetWindowProperty(QX11Info::display(), appRootWindow, icc_atom, 0, INT_MAX, False, XA_CARDINAL, &type, &format, &nitems, &bytes_after, (unsigned char**) &str) == Success && nitems ) { QByteArray bytes = QByteArray::fromRawData((char*)str, (quint32)nitems); if (!bytes.isEmpty()) { profile = bytes; } kDebug() << "Found X.org XICC monitor profile" << profile.description(); } /* else { kDebug() << "No X.org XICC profile installed for screen" << screenNumber; } */ // insert to cache even if null { QMutexLocker lock(&mutex); screenProfiles.insert(screenNumber, profile); } return profile; #elif defined Q_WS_WIN //TODO #elif defined Q_WS_MAC //TODO #endif return IccProfile(); }