Commit 338ffeee authored by Nathaniel Graham's avatar Nathaniel Graham

Add a user-facing control to choose the ICC color rendering intent

Summary:
FEATURE: 359909
FIXED-IN: 18.04

Allow the user to choose the ICC color rendering intent, instead of hardcoding INTENT_PERCEPTUAL

Supersedes D8763

Test Plan:
The GUI control appears and seems to work as intended.

{F5680320}

- Tested that the default value of Perceptual is used when there is no value in ~/.config/gwenviewrc
- Tested that the value gets set in ~/.config/gwenviewrc
- Tested that removing the value in ~/.config/gwenviewrc reverts the GUI setting to Perceptual
- Tested that toggling the setting back and forth actually has an impact when using a display with an active color profile. Here's an example:

Perceptual:
{F5677933}

Relative Colorimetric:
{F5677990}

Reviewers: DrSlony, rkflx

Reviewed By: rkflx

Subscribers: muhlenpfordt, rempt, behrmann

Differential Revision: https://phabricator.kde.org/D10076
parent 8a6a4ea6
......@@ -56,7 +56,7 @@
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<spacer name="verticalSpacer_1">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
......@@ -106,14 +106,107 @@
</layout>
</item>
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<widget class="QLabel" name="colorRenderingLabel">
<property name="text">
<string>Rendering intent:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>relativeRenderingIntentRadioButton</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QRadioButton" name="perceptualRenderingIntentRadioButton">
<property name="text">
<string comment="@option:Perceptual rendering intent">Perceptual</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1">
<widget class="QLabel" name="perceptualHelpLabel">
<property name="text">
<string>Scale all colors equally to fit them within the active color profile's color gamut</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="relativeRenderingIntentRadioButton">
<property name="text">
<string comment="@option:Relative Colorimetric rendering intent">Relative Colorimetric</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="9" column="1">
<widget class="QLabel" name="relativeHelpLabel">
<property name="text">
<string>Squash colors that don't fit within the active color profile's color gamut, leaving other colors untouched</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="1">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>151</height>
<height>20</height>
</size>
</property>
</spacer>
......
......@@ -91,9 +91,17 @@ ConfigDialog::ConfigDialog(QWidget* parent)
// 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();
}
......
......@@ -50,6 +50,7 @@ private:
InvisibleButtonGroup* mAnimationMethodGroup;
InvisibleButtonGroup* mZoomModeGroup;
InvisibleButtonGroup* mThumbnailBarOrientationGroup;
InvisibleButtonGroup* mRenderingIntentGroup;
Ui_GeneralConfigPage mGeneralConfigPage;
Ui_ImageViewConfigPage mImageViewConfigPage;
Ui_AdvancedConfigPage mAdvancedConfigPage;
......
......@@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include <lib/imagescaler.h>
#include <lib/cms/cmsprofile.h>
#include <lib/gvdebug.h>
#include <lib/gwenviewconfig.h>
// KDE
......@@ -106,9 +107,19 @@ struct RasterImageViewPrivate
qWarning() << "Gwenview can only apply color profile on RGB32 or ARGB32 images";
return;
}
cmsUInt32Number renderingIntent = 0;
switch (GwenviewConfig::renderingIntent()) {
case RenderingIntent::Perceptual:
renderingIntent = INTENT_PERCEPTUAL;
break;
case RenderingIntent::Relative:
renderingIntent = INTENT_RELATIVE_COLORIMETRIC;
break;
}
mDisplayTransform = cmsCreateTransform(profile->handle(), cmsFormat,
monitorProfile->handle(), cmsFormat,
INTENT_PERCEPTUAL, cmsFLAGS_BLACKPOINTCOMPENSATION);
renderingIntent, cmsFLAGS_BLACKPOINTCOMPENSATION);
mApplyDisplayTransform = true;
}
......
......@@ -11,6 +11,7 @@
<include>lib/documentview/documentview.h</include>
<include>lib/documentview/rasterimageview.h</include>
<include>lib/print/printoptionspage.h</include>
<include>lib/renderingintent.h</include>
<group name="SideBar">
<entry name="PreferredMetaInfoKeyList" type="StringList">
<default>General.Name,General.ImageSize,Exif.Photo.ExposureTime,Exif.Photo.Flash</default>
......@@ -158,6 +159,20 @@
own zoom and position (if these are changed, image A will NOT
be displayed with the updated zoom and position).</whatsthis>
</entry>
<entry name="RenderingIntent" type="Enum">
<choices name="Gwenview::RenderingIntent::Enum">
<choice name="RenderingIntent::Perceptual"/>
<choice name="RenderingIntent::Relative"/>
</choices>
<default>RenderingIntent::Perceptual</default>
<whatsthis>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.</whatsthis>
</entry>
</group>
<group name="ThumbnailView">
......
// vim: set tabstop=4 shiftwidth=4 expandtab:
/*
Gwenview: an image viewer
Copyright 2018 Nate Graham <pointedstick@zoho.com>
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 RenderingIntent
} // namespace Gwenview
#endif /* RENDERINGINTENT_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment