Color adaptation (just settings), options dialog adjustments

This commit is contained in:
Jakub Melka 2021-05-06 18:31:40 +02:00
parent c0cdcb28de
commit a34ee620b9
6 changed files with 182 additions and 80 deletions

View File

@ -541,7 +541,6 @@ QColor PDFLittleCMS::getColorFromDeviceCMYK(const PDFColor& color, RenderingInte
QColor PDFLittleCMS::getColorFromXYZ(const PDFColor3& whitePoint, const PDFColor3& color, RenderingIntent intent, PDFRenderErrorReporter* reporter) const QColor PDFLittleCMS::getColorFromXYZ(const PDFColor3& whitePoint, const PDFColor3& color, RenderingIntent intent, PDFRenderErrorReporter* reporter) const
{ {
Q_UNUSED(whitePoint);
cmsHTRANSFORM transform = getTransform(XYZ, getEffectiveRenderingIntent(intent), false); cmsHTRANSFORM transform = getTransform(XYZ, getEffectiveRenderingIntent(intent), false);
if (!transform) if (!transform)

View File

@ -55,12 +55,22 @@ struct PDFCMSSettings
High High
}; };
enum class ColorAdaptationXYZ
{
None,
XYZScaling,
CAT97,
CAT02,
Bradford
};
bool operator==(const PDFCMSSettings&) const = default; bool operator==(const PDFCMSSettings&) const = default;
System system = System::Generic; System system = System::Generic;
Accuracy accuracy = Accuracy::Medium; Accuracy accuracy = Accuracy::Medium;
RenderingIntent intent = RenderingIntent::Auto; RenderingIntent intent = RenderingIntent::Auto;
RenderingIntent proofingIntent = RenderingIntent::RelativeColorimetric; RenderingIntent proofingIntent = RenderingIntent::RelativeColorimetric;
ColorAdaptationXYZ colorAdaptationXYZ = ColorAdaptationXYZ::Bradford;
bool isBlackPointCompensationActive = true; bool isBlackPointCompensationActive = true;
bool isWhitePaperColorTransformed = false; bool isWhitePaperColorTransformed = false;
bool isGamutChecking = false; bool isGamutChecking = false;

View File

@ -65,6 +65,7 @@ void PDFViewerSettings::readSettings(QSettings& settings, const pdf::PDFCMSSetti
m_colorManagementSystemSettings.system = static_cast<pdf::PDFCMSSettings::System>(settings.value("system", int(defaultCMSSettings.system)).toInt()); m_colorManagementSystemSettings.system = static_cast<pdf::PDFCMSSettings::System>(settings.value("system", int(defaultCMSSettings.system)).toInt());
m_colorManagementSystemSettings.accuracy = static_cast<pdf::PDFCMSSettings::Accuracy>(settings.value("accuracy", int(defaultCMSSettings.accuracy)).toInt()); m_colorManagementSystemSettings.accuracy = static_cast<pdf::PDFCMSSettings::Accuracy>(settings.value("accuracy", int(defaultCMSSettings.accuracy)).toInt());
m_colorManagementSystemSettings.intent = static_cast<pdf::RenderingIntent>(settings.value("intent", int(defaultCMSSettings.intent)).toInt()); m_colorManagementSystemSettings.intent = static_cast<pdf::RenderingIntent>(settings.value("intent", int(defaultCMSSettings.intent)).toInt());
m_colorManagementSystemSettings.colorAdaptationXYZ = static_cast<pdf::PDFCMSSettings::ColorAdaptationXYZ>(settings.value("colorAdaptationXYZ"), int(defaultCMSSettings.colorAdaptationXYZ));
m_colorManagementSystemSettings.isBlackPointCompensationActive = settings.value("isBlackPointCompensationActive", defaultCMSSettings.isBlackPointCompensationActive).toBool(); m_colorManagementSystemSettings.isBlackPointCompensationActive = settings.value("isBlackPointCompensationActive", defaultCMSSettings.isBlackPointCompensationActive).toBool();
m_colorManagementSystemSettings.isWhitePaperColorTransformed = settings.value("isWhitePaperColorTransformed", defaultCMSSettings.isWhitePaperColorTransformed).toBool(); m_colorManagementSystemSettings.isWhitePaperColorTransformed = settings.value("isWhitePaperColorTransformed", defaultCMSSettings.isWhitePaperColorTransformed).toBool();
m_colorManagementSystemSettings.isConsiderOutputIntent = settings.value("isConsiderOutputIntent", defaultCMSSettings.isConsiderOutputIntent).toBool(); m_colorManagementSystemSettings.isConsiderOutputIntent = settings.value("isConsiderOutputIntent", defaultCMSSettings.isConsiderOutputIntent).toBool();
@ -131,6 +132,7 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
settings.setValue("system", int(m_colorManagementSystemSettings.system)); settings.setValue("system", int(m_colorManagementSystemSettings.system));
settings.setValue("accuracy", int(m_colorManagementSystemSettings.accuracy)); settings.setValue("accuracy", int(m_colorManagementSystemSettings.accuracy));
settings.setValue("intent", int(m_colorManagementSystemSettings.intent)); settings.setValue("intent", int(m_colorManagementSystemSettings.intent));
settings.setValue("colorAdaptationXYZ", int(m_colorManagementSystemSettings.colorAdaptationXYZ));
settings.setValue("isBlackPointCompensationActive", m_colorManagementSystemSettings.isBlackPointCompensationActive); settings.setValue("isBlackPointCompensationActive", m_colorManagementSystemSettings.isBlackPointCompensationActive);
settings.setValue("isWhitePaperColorTransformed", m_colorManagementSystemSettings.isWhitePaperColorTransformed); settings.setValue("isWhitePaperColorTransformed", m_colorManagementSystemSettings.isWhitePaperColorTransformed);
settings.setValue("isConsiderOutputIntent", m_colorManagementSystemSettings.isConsiderOutputIntent); settings.setValue("isConsiderOutputIntent", m_colorManagementSystemSettings.isConsiderOutputIntent);

View File

@ -20,6 +20,7 @@
#include "pdfglobal.h" #include "pdfglobal.h"
#include "pdfutils.h" #include "pdfutils.h"
#include "pdfwidgetutils.h"
#include "pdfrecentfilemanager.h" #include "pdfrecentfilemanager.h"
#include <QAction> #include <QAction>
@ -31,10 +32,28 @@
#include <QNetworkReply> #include <QNetworkReply>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QDomDocument> #include <QDomDocument>
#include <QStyledItemDelegate>
namespace pdfviewer namespace pdfviewer
{ {
class SettingsDelegate : public QStyledItemDelegate
{
public:
SettingsDelegate(QObject* parent) :
QStyledItemDelegate(parent)
{
}
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
QSize size = QStyledItemDelegate::sizeHint(option, index);
size.setHeight(qMax(size.height(), pdf::PDFWidgetUtils::scaleDPI_y(qobject_cast<QWidget*>(parent()), 48)));
return size;
}
};
PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settings& settings, PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settings& settings,
const pdf::PDFCMSSettings& cmsSettings, const pdf::PDFCMSSettings& cmsSettings,
const OtherSettings& otherSettings, const OtherSettings& otherSettings,
@ -74,6 +93,15 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
new QListWidgetItem(QIcon(":/resources/signature.svg"), tr("Signature"), ui->optionsPagesWidget, SignatureSettings); new QListWidgetItem(QIcon(":/resources/signature.svg"), tr("Signature"), ui->optionsPagesWidget, SignatureSettings);
new QListWidgetItem(QIcon(":/resources/plugins.svg"), tr("Plugins"), ui->optionsPagesWidget, PluginsSettings); new QListWidgetItem(QIcon(":/resources/plugins.svg"), tr("Plugins"), ui->optionsPagesWidget, PluginsSettings);
ui->optionsPagesWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->optionsPagesWidget->setItemDelegate(new SettingsDelegate(ui->optionsPagesWidget));
ui->optionsPagesWidget->setIconSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(32, 32)));
// Scale font
QFont font = ui->optionsPagesWidget->font();
font.setPointSize(font.pointSize() * 1.5);
ui->optionsPagesWidget->setFont(font);
ui->renderingEngineComboBox->addItem(tr("Software"), static_cast<int>(pdf::RendererEngine::Software)); ui->renderingEngineComboBox->addItem(tr("Software"), static_cast<int>(pdf::RendererEngine::Software));
ui->renderingEngineComboBox->addItem(tr("Hardware accelerated (OpenGL)"), static_cast<int>(pdf::RendererEngine::OpenGL)); ui->renderingEngineComboBox->addItem(tr("Hardware accelerated (OpenGL)"), static_cast<int>(pdf::RendererEngine::OpenGL));
@ -103,6 +131,12 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
ui->cmsAccuracyComboBox->addItem(tr("Medium"), int(pdf::PDFCMSSettings::Accuracy::Medium)); ui->cmsAccuracyComboBox->addItem(tr("Medium"), int(pdf::PDFCMSSettings::Accuracy::Medium));
ui->cmsAccuracyComboBox->addItem(tr("High"), int(pdf::PDFCMSSettings::Accuracy::High)); ui->cmsAccuracyComboBox->addItem(tr("High"), int(pdf::PDFCMSSettings::Accuracy::High));
ui->cmsColorAdaptationXYZComboBox->addItem(tr("None"), int (pdf::PDFCMSSettings::ColorAdaptationXYZ::None));
ui->cmsColorAdaptationXYZComboBox->addItem(tr("XYZ scaling"), int (pdf::PDFCMSSettings::ColorAdaptationXYZ::XYZScaling));
ui->cmsColorAdaptationXYZComboBox->addItem(tr("CAT97 matrix"), int (pdf::PDFCMSSettings::ColorAdaptationXYZ::CAT97));
ui->cmsColorAdaptationXYZComboBox->addItem(tr("CAT02 matrix"), int (pdf::PDFCMSSettings::ColorAdaptationXYZ::CAT02));
ui->cmsColorAdaptationXYZComboBox->addItem(tr("Bradford method"), int (pdf::PDFCMSSettings::ColorAdaptationXYZ::Bradford));
auto fillColorProfileList = [](QComboBox* comboBox, const pdf::PDFColorProfileIdentifiers& identifiers) auto fillColorProfileList = [](QComboBox* comboBox, const pdf::PDFColorProfileIdentifiers& identifiers)
{ {
for (const pdf::PDFColorProfileIdentifier& identifier : identifiers) for (const pdf::PDFColorProfileIdentifier& identifier : identifiers)
@ -158,6 +192,8 @@ PDFViewerSettingsDialog::PDFViewerSettingsDialog(const PDFViewerSettings::Settin
connect(ui->trustedCertificateStoreTableWidget, &QTableWidget::itemSelectionChanged, this, &PDFViewerSettingsDialog::updateTrustedCertificatesTableActions); connect(ui->trustedCertificateStoreTableWidget, &QTableWidget::itemSelectionChanged, this, &PDFViewerSettingsDialog::updateTrustedCertificatesTableActions);
connect(ui->pluginsTableWidget, &QTableWidget::itemSelectionChanged, this, &PDFViewerSettingsDialog::updatePluginInformation); connect(ui->pluginsTableWidget, &QTableWidget::itemSelectionChanged, this, &PDFViewerSettingsDialog::updatePluginInformation);
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(1000, 700)));
ui->optionsPagesWidget->setCurrentRow(0); ui->optionsPagesWidget->setCurrentRow(0);
adjustSize(); adjustSize();
loadData(); loadData();
@ -304,6 +340,8 @@ void PDFViewerSettingsDialog::loadData()
ui->cmsRenderingIntentComboBox->setCurrentIndex(ui->cmsRenderingIntentComboBox->findData(int(m_cmsSettings.intent))); ui->cmsRenderingIntentComboBox->setCurrentIndex(ui->cmsRenderingIntentComboBox->findData(int(m_cmsSettings.intent)));
ui->cmsAccuracyComboBox->setEnabled(true); ui->cmsAccuracyComboBox->setEnabled(true);
ui->cmsAccuracyComboBox->setCurrentIndex(ui->cmsAccuracyComboBox->findData(int(m_cmsSettings.accuracy))); ui->cmsAccuracyComboBox->setCurrentIndex(ui->cmsAccuracyComboBox->findData(int(m_cmsSettings.accuracy)));
ui->cmsColorAdaptationXYZComboBox->setEnabled(true);
ui->cmsColorAdaptationXYZComboBox->setCurrentIndex(ui->cmsColorAdaptationXYZComboBox->findData(int(m_cmsSettings.colorAdaptationXYZ)));
ui->cmsIsBlackPointCompensationCheckBox->setEnabled(true); ui->cmsIsBlackPointCompensationCheckBox->setEnabled(true);
ui->cmsIsBlackPointCompensationCheckBox->setChecked(m_cmsSettings.isBlackPointCompensationActive); ui->cmsIsBlackPointCompensationCheckBox->setChecked(m_cmsSettings.isBlackPointCompensationActive);
ui->cmsConsiderOutputIntentCheckBox->setEnabled(true); ui->cmsConsiderOutputIntentCheckBox->setEnabled(true);
@ -328,6 +366,8 @@ void PDFViewerSettingsDialog::loadData()
ui->cmsRenderingIntentComboBox->setCurrentIndex(-1); ui->cmsRenderingIntentComboBox->setCurrentIndex(-1);
ui->cmsAccuracyComboBox->setEnabled(false); ui->cmsAccuracyComboBox->setEnabled(false);
ui->cmsAccuracyComboBox->setCurrentIndex(-1); ui->cmsAccuracyComboBox->setCurrentIndex(-1);
ui->cmsColorAdaptationXYZComboBox->setEnabled(false);
ui->cmsColorAdaptationXYZComboBox->setCurrentIndex(-1);
ui->cmsIsBlackPointCompensationCheckBox->setEnabled(false); ui->cmsIsBlackPointCompensationCheckBox->setEnabled(false);
ui->cmsIsBlackPointCompensationCheckBox->setChecked(false); ui->cmsIsBlackPointCompensationCheckBox->setChecked(false);
ui->cmsConsiderOutputIntentCheckBox->setEnabled(false); ui->cmsConsiderOutputIntentCheckBox->setEnabled(false);
@ -473,6 +513,10 @@ void PDFViewerSettingsDialog::saveData()
{ {
m_cmsSettings.accuracy = static_cast<pdf::PDFCMSSettings::Accuracy>(ui->cmsAccuracyComboBox->currentData().toInt()); m_cmsSettings.accuracy = static_cast<pdf::PDFCMSSettings::Accuracy>(ui->cmsAccuracyComboBox->currentData().toInt());
} }
else if (sender == ui->cmsColorAdaptationXYZComboBox)
{
m_cmsSettings.colorAdaptationXYZ = static_cast<pdf::PDFCMSSettings::ColorAdaptationXYZ>(ui->cmsColorAdaptationXYZComboBox->currentData().toInt());
}
else if (sender == ui->cmsIsBlackPointCompensationCheckBox) else if (sender == ui->cmsIsBlackPointCompensationCheckBox)
{ {
m_cmsSettings.isBlackPointCompensationActive = ui->cmsIsBlackPointCompensationCheckBox->isChecked(); m_cmsSettings.isBlackPointCompensationActive = ui->cmsIsBlackPointCompensationCheckBox->isChecked();

View File

@ -18,15 +18,24 @@
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,3"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,3">
<item> <item>
<widget class="QListWidget" name="optionsPagesWidget"> <widget class="QListWidget" name="optionsPagesWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QStackedWidget" name="stackedWidget"> <widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>7</number> <number>5</number>
</property> </property>
<widget class="QWidget" name="enginePage"> <widget class="QWidget" name="enginePage">
<layout class="QVBoxLayout" name="enginePageLayout"> <layout class="QVBoxLayout" name="enginePageLayout">
@ -610,42 +619,28 @@
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item> <item>
<layout class="QGridLayout" name="cmsWidgetsLayout" columnstretch="1,1"> <layout class="QGridLayout" name="cmsWidgetsLayout" columnstretch="1,1">
<item row="1" column="1"> <item row="7" column="1">
<widget class="QComboBox" name="cmsRenderingIntentComboBox"/> <widget class="QComboBox" name="cmsOutputColorProfileComboBox"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="cmsBlackPointCompensationLabel">
<property name="text">
<string>Black point compensation</string>
</property>
</widget>
</item> </item>
<item row="8" column="0"> <item row="8" column="0">
<widget class="QLabel" name="cmsDeviceRGBProfileLabel"> <widget class="QLabel" name="cmsDeviceGrayColorProfileLabel">
<property name="text"> <property name="text">
<string>Device RGB color profile</string> <string>Device gray color profile</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="cmsTypeComboBox"/> <widget class="QComboBox" name="cmsTypeComboBox"/>
</item> </item>
<item row="4" column="1">
<widget class="QCheckBox" name="cmsWhitePaperColorTransformedCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="cmsWhitePaperColorTransformedLabel">
<property name="text">
<string>White paper color transformed</string>
</property>
</widget>
</item>
<item row="8" column="1"> <item row="8" column="1">
<widget class="QComboBox" name="cmsDeviceRGBColorProfileComboBox"/> <widget class="QComboBox" name="cmsDeviceGrayColorProfileComboBox"/>
</item>
<item row="9" column="0">
<widget class="QLabel" name="cmsDeviceCMYKColorProfileLabel">
<property name="text">
<string>Device CMYK color profile</string>
</property>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="cmsAccuracyLabel"> <widget class="QLabel" name="cmsAccuracyLabel">
@ -654,21 +649,50 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="cmsAccuracyComboBox"/> <widget class="QComboBox" name="cmsRenderingIntentComboBox"/>
</item> </item>
<item row="5" column="0"> <item row="6" column="0">
<widget class="QLabel" name="cmsProfileDirectoryLabel"> <widget class="QLabel" name="cmsProfileDirectoryLabel">
<property name="text"> <property name="text">
<string>Additional color profile directory</string> <string>Additional color profile directory</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="5" column="0">
<widget class="QComboBox" name="cmsOutputColorProfileComboBox"/> <widget class="QLabel" name="cmsWhitePaperColorTransformedLabel">
<property name="text">
<string>White paper color transformed</string>
</property>
</widget>
</item> </item>
<item row="9" column="1"> <item row="11" column="1">
<widget class="QComboBox" name="cmsDeviceCMYKColorProfileComboBox"/> <widget class="QCheckBox" name="cmsConsiderOutputIntentCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="cmsOutputProfileLabel">
<property name="text">
<string>Output color profile</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="cmsIsBlackPointCompensationCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="cmsWhitePaperColorTransformedCheckBox">
<property name="text">
<string>Enable</string>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="cmsRenderingIntentLabel"> <widget class="QLabel" name="cmsRenderingIntentLabel">
@ -677,10 +701,41 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="9" column="1">
<widget class="QComboBox" name="cmsDeviceGrayColorProfileComboBox"/> <widget class="QComboBox" name="cmsDeviceRGBColorProfileComboBox"/>
</item> </item>
<item row="5" column="1"> <item row="10" column="1">
<widget class="QComboBox" name="cmsDeviceCMYKColorProfileComboBox"/>
</item>
<item row="11" column="0">
<widget class="QLabel" name="cmsConsiderOutputIntentLabel">
<property name="text">
<string>Consider document output intents</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="cmsDeviceRGBProfileLabel">
<property name="text">
<string>Device RGB color profile</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="cmsLabel">
<property name="text">
<string>Color management system</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="cmsDeviceCMYKColorProfileLabel">
<property name="text">
<string>Device CMYK color profile</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="cmsProfileDirectoryLayout"> <layout class="QHBoxLayout" name="cmsProfileDirectoryLayout">
<item> <item>
<widget class="QLineEdit" name="cmsProfileDirectoryEdit"/> <widget class="QLineEdit" name="cmsProfileDirectoryEdit"/>
@ -694,52 +749,16 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="6" column="0"> <item row="2" column="1">
<widget class="QLabel" name="cmsOutputProfileLabel"> <widget class="QComboBox" name="cmsAccuracyComboBox"/>
<property name="text">
<string>Output color profile</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="cmsLabel">
<property name="text">
<string>Color management system</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="cmsBlackPointCompensationLabel">
<property name="text">
<string>Black point compensation</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="cmsDeviceGrayColorProfileLabel">
<property name="text">
<string>Device gray color profile</string>
</property>
</widget>
</item> </item>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QCheckBox" name="cmsIsBlackPointCompensationCheckBox"> <widget class="QComboBox" name="cmsColorAdaptationXYZComboBox"/>
<property name="text">
<string>Enable</string>
</property>
</widget>
</item> </item>
<item row="10" column="1"> <item row="3" column="0">
<widget class="QCheckBox" name="cmsConsiderOutputIntentCheckBox"> <widget class="QLabel" name="cmsColorAdaptationMethodLabel">
<property name="text"> <property name="text">
<string>Enable</string> <string>Color adaptation method (XYZ whitepoint)</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="cmsConsiderOutputIntentLabel">
<property name="text">
<string>Consider document output intents</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -280,6 +280,7 @@ void PDFToolAbstractApplication::initializeCommandLineParser(QCommandLineParser*
{ {
parser->addOption(QCommandLineOption("cms", "Color management system. Valid values are generic|lcms.", "cms", "lcms")); parser->addOption(QCommandLineOption("cms", "Color management system. Valid values are generic|lcms.", "cms", "lcms"));
parser->addOption(QCommandLineOption("cms-accuracy", "Accuracy of cms system. Valid values are low|medium|high. Higher accuracy means higher memory consumption.", "accuracy", "medium")); parser->addOption(QCommandLineOption("cms-accuracy", "Accuracy of cms system. Valid values are low|medium|high. Higher accuracy means higher memory consumption.", "accuracy", "medium"));
parser->addOption(QCommandLineOption("cms-color-adaptation", "Color adaptation method for XYZ whitepoint scaling. Valid values are none|xyzscaling|cat97|cat02|bradford. Higher accuracy means higher memory consumption.", "color-adaptation-method", "bradford"));
parser->addOption(QCommandLineOption("cms-intent", "Rendering intent. Valid values are auto|perceptual|abs|rel|saturation.", "intent", "auto")); parser->addOption(QCommandLineOption("cms-intent", "Rendering intent. Valid values are auto|perceptual|abs|rel|saturation.", "intent", "auto"));
parser->addOption(QCommandLineOption("cms-black-compensated", "Black point compensation.", "bool", "1")); parser->addOption(QCommandLineOption("cms-black-compensated", "Black point compensation.", "bool", "1"));
parser->addOption(QCommandLineOption("cms-white-paper-trans", "Transform also color of paper using cms.", "bool", "0")); parser->addOption(QCommandLineOption("cms-white-paper-trans", "Transform also color of paper using cms.", "bool", "0"));
@ -727,6 +728,33 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
options.cmsSettings.accuracy = pdf::PDFCMSSettings::Accuracy::Medium; options.cmsSettings.accuracy = pdf::PDFCMSSettings::Accuracy::Medium;
} }
QString colorAdaptationMethod = parser->value("cms-color-adaptation");
if (colorAdaptationMethod == "none")
{
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::None;
}
else if (colorAdaptationMethod == "xyzscaling")
{
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::XYZScaling;
}
else if (colorAdaptationMethod == "cat97")
{
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::CAT97;
}
else if (colorAdaptationMethod == "cat02")
{
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::CAT02;
}
else if (colorAdaptationMethod == "bradford")
{
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::Bradford;
}
else
{
PDFConsole::writeError(PDFToolTranslationContext::tr("Unknown color adaptation method '%1'. Defaulting to bradford.").arg(colorAdaptationMethod), options.outputCodec);
options.cmsSettings.colorAdaptationXYZ = pdf::PDFCMSSettings::ColorAdaptationXYZ::Bradford;
}
QString intent = parser->value("cms-intent"); QString intent = parser->value("cms-intent");
if (intent == "auto") if (intent == "auto")
{ {