예제 #1
0
void SoftProofDialog::slotProfileInfo()
{
    IccProfile profile = d->deviceProfileBox->currentProfile();

    if (profile.isNull())
    {
        QMessageBox::critical(this, i18n("Profile Error"), i18n("No profile is selected."));
        return;
    }

    ICCProfileInfoDlg infoDlg(this, profile.filePath(), profile);
    infoDlg.exec();
}
예제 #2
0
LoadingDescription PreviewLoadThread::createLoadingDescription(const QString& filePath, const PreviewSettings& previewSettings, int size, const IccProfile& displayProfile)
{
    LoadingDescription description(filePath, previewSettings, size);

    if (DImg::fileFormat(filePath) == DImg::RAW)
    {
        description.rawDecodingSettings.optimizeTimeLoading();
        description.rawDecodingSettings.rawPrm.sixteenBitsImage   = false;
        description.rawDecodingSettings.rawPrm.halfSizeColorImage = true;
        description.rawDecodingHint                               = LoadingDescription::RawDecodingTimeOptimized;
    }

    ICCSettingsContainer settings = IccSettings::instance()->settings();

    if (settings.enableCM && settings.useManagedPreviews)
    {
        description.postProcessingParameters.colorManagement = LoadingDescription::ConvertForDisplay;
        if (displayProfile.isNull())
        {
            description.postProcessingParameters.setProfile(IccProfile::sRGB());
        }
        else
        {
            description.postProcessingParameters.setProfile(displayProfile);
        }
    }

    return description;
}
예제 #3
0
bool IccProfile::isSameProfileAs(IccProfile& other)
{
    if (d == other.d)
    {
        return true;
    }

    if (d && other.d)
    {
        // uses memcmp
        return data() == other.data();
    }

    return false;
}
예제 #4
0
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;
}
예제 #5
0
ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* const parent, const QString& profilePath, const IccProfile& profile)
    : KDialog(parent)
{
    setCaption(i18n("Color Profile Info - %1", profilePath));
    setButtons(Help|Ok);
    setDefaultButton(Ok);
    setModal(true);
    setHelp("iccprofile.anchor", "digikam");

    ICCProfileWidget* const profileWidget = new ICCProfileWidget(this, 340, 256);

    if (profile.isNull())
    {
        profileWidget->loadFromURL(KUrl(profilePath));
    }
    else
    {
        profileWidget->loadProfile(profilePath, profile);
    }

    setMainWidget(profileWidget);
}
예제 #6
0
/*
 * 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();
}