diff --git a/app/advancedconfigpage.ui b/app/advancedconfigpage.ui --- a/app/advancedconfigpage.ui +++ b/app/advancedconfigpage.ui @@ -107,13 +107,106 @@ + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Rendering intent: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + relativeRenderingIntentRadioButton + + + + + + + + + Perceptual + + + true + + + + + + + + + Scale all colors equally to fit them within the active color profile's color gamut + + + true + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + + + Relative + + + true + + + + + + + + + Squash colors that don't fit within the active color profile's color gamut, leaving other colors untouched + + + true + + + + + Qt::Vertical 20 - 151 + 20 diff --git a/app/configdialog.h b/app/configdialog.h --- a/app/configdialog.h +++ b/app/configdialog.h @@ -50,6 +50,7 @@ InvisibleButtonGroup* mAnimationMethodGroup; InvisibleButtonGroup* mZoomModeGroup; InvisibleButtonGroup* mThumbnailBarOrientationGroup; + InvisibleButtonGroup* mRenderingIntentGroup; Ui_GeneralConfigPage mGeneralConfigPage; Ui_ImageViewConfigPage mImageViewConfigPage; Ui_AdvancedConfigPage mAdvancedConfigPage; diff --git a/app/configdialog.cpp b/app/configdialog.cpp --- a/app/configdialog.cpp +++ b/app/configdialog.cpp @@ -91,9 +91,17 @@ // Advanced widget = setupPage(mAdvancedConfigPage); + + mRenderingIntentGroup = new InvisibleButtonGroup(widget); + mRenderingIntentGroup->setObjectName(QLatin1String("kcfg_RenderingIntent")); + mRenderingIntentGroup->addButton(mAdvancedConfigPage.relativeRenderingIntentRadioButton, int(RenderingIntent::Relative)); + mRenderingIntentGroup->addButton(mAdvancedConfigPage.perceptualRenderingIntentRadioButton, int(RenderingIntent::Perceptual)); + pageItem = addPage(widget, i18n("Advanced")); pageItem->setIcon(QIcon::fromTheme("preferences-other")); mAdvancedConfigPage.cacheHelpLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); + mAdvancedConfigPage.perceptualHelpLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); + mAdvancedConfigPage.relativeHelpLabel->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); updateViewBackgroundFrame(); } diff --git a/lib/documentview/rasterimageview.cpp b/lib/documentview/rasterimageview.cpp --- a/lib/documentview/rasterimageview.cpp +++ b/lib/documentview/rasterimageview.cpp @@ -26,6 +26,7 @@ #include #include #include +#include // KDE @@ -106,9 +107,16 @@ qWarning() << "Gwenview can only apply color profile on RGB32 or ARGB32 images"; return; } + + int renderingIntent; + if (GwenviewConfig::renderingIntent() == RenderingIntent::Perceptual) { + renderingIntent = INTENT_PERCEPTUAL; + } else { + renderingIntent = INTENT_RELATIVE_COLORIMETRIC; + } mDisplayTransform = cmsCreateTransform(profile->handle(), cmsFormat, monitorProfile->handle(), cmsFormat, - INTENT_PERCEPTUAL, cmsFLAGS_BLACKPOINTCOMPENSATION); + renderingIntent, cmsFLAGS_BLACKPOINTCOMPENSATION); mApplyDisplayTransform = true; } diff --git a/lib/gwenviewconfig.kcfg b/lib/gwenviewconfig.kcfg --- a/lib/gwenviewconfig.kcfg +++ b/lib/gwenviewconfig.kcfg @@ -11,6 +11,7 @@ lib/documentview/documentview.h lib/documentview/rasterimageview.h lib/print/printoptionspage.h + lib/renderingintent.h General.Name,General.ImageSize,Exif.Photo.ExposureTime,Exif.Photo.Flash @@ -158,6 +159,20 @@ own zoom and position (if these are changed, image A will NOT be displayed with the updated zoom and position). + + + + + + + RenderingIntent::Perceptual + Defines how colors are rendered when your display + uses an ICC color profile and an image has colors that do not + fit within the profile's color gamut. "Perceptual" will scale + the colors of the entire image so that they all fit within the + display's capabilities. "Relative" will squash only the colors + that cannot be displayed, and leave the other colors alone. + diff --git a/lib/renderingintent.h b/lib/renderingintent.h new file mode 100644 --- /dev/null +++ b/lib/renderingintent.h @@ -0,0 +1,47 @@ +// vim: set tabstop=4 shiftwidth=4 expandtab: +/* +Gwenview: an image viewer +Copyright 2018 Nate Graham + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA. + +*/ +#ifndef RENDERINGINTENT_H +#define RENDERINGINTENT_H + +// Qt + +// KDE + +// Local + +namespace Gwenview +{ + +namespace RenderingIntent +{ +/** + * This enum represents the different color rendering modes + */ +enum Enum { + Perceptual, + Relative, +}; + +} // namespace Sorting + +} // namespace Gwenview + +#endif /* SORTING_H */