Soft proofing bugfixing

This commit is contained in:
Jakub Melka 2020-12-26 12:55:29 +01:00
parent 468a492e19
commit 8760a5ff17
7 changed files with 56 additions and 23 deletions

View File

@ -537,7 +537,11 @@ void PDFLittleCMS::init()
m_profiles[SoftProofing] = createProfile(m_settings.softProofingProfile, m_manager->getCMYKProfiles());
m_profiles[XYZ] = cmsCreateXYZProfile();
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { 0xFFFF };
cmsUInt16Number outOfGamutR = m_settings.outOfGamutColor.redF() * 0xFFFF;
cmsUInt16Number outOfGamutG = m_settings.outOfGamutColor.greenF() * 0xFFFF;
cmsUInt16Number outOfGamutB = m_settings.outOfGamutColor.blueF() * 0xFFFF;
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { outOfGamutR, outOfGamutG, outOfGamutB };
cmsSetAlarmCodes(alarmCodes);
if (m_settings.isWhitePaperColorTransformed)

View File

@ -65,6 +65,7 @@ struct PDFCMSSettings
bool isWhitePaperColorTransformed = false;
bool isGamutChecking = false;
bool isSoftProofing = false;
QColor outOfGamutColor = Qt::red; ///< Color, which marks out-of-gamut when soft-proofing is proceeded
QString outputCS; ///< Output (rendering) color space
QString deviceGray; ///< Identifiers for color space (device gray)
QString deviceRGB; ///< Identifiers for color space (device RGB)

View File

@ -515,6 +515,7 @@ void PDFProgramController::initialize(Features features,
connect(m_pdfWidget->getDrawWidgetProxy(), &pdf::PDFDrawWidgetProxy::pageLayoutChanged, this, &PDFProgramController::onPageLayoutChanged);
connect(m_pdfWidget, &pdf::PDFWidget::pageRenderingErrorsChanged, this, &PDFProgramController::onPageRenderingErrorsChanged, Qt::QueuedConnection);
connect(m_settings, &PDFViewerSettings::settingsChanged, this, &PDFProgramController::onViewerSettingsChanged);
connect(m_CMSManager, &pdf::PDFCMSManager::colorManagementSystemChanged, this, &PDFProgramController::onColorManagementSystemChanged);
if (features.testFlag(TextToSpeech))
{
@ -1341,7 +1342,6 @@ void PDFProgramController::updateActionsAvailability()
updateUndoRedoActions();
}
void PDFProgramController::onViewerSettingsChanged()
{
m_pdfWidget->updateRenderer(m_settings->getRendererEngine(), m_settings->isMultisampleAntialiasingEnabled() ? m_settings->getRendererSamples() : -1);
@ -1357,6 +1357,11 @@ void PDFProgramController::onViewerSettingsChanged()
updateRenderingOptionActions();
}
void PDFProgramController::onColorManagementSystemChanged()
{
m_settings->setColorManagementSystemSettings(m_CMSManager->getSettings());
}
void PDFProgramController::updateFileInfo(const QString& fileName)
{
QFileInfo fileInfo(fileName);

View File

@ -334,6 +334,7 @@ private:
void onQueryPasswordRequest(QString* password, bool* ok);
void onPageRenderingErrorsChanged(pdf::PDFInteger pageIndex, int errorsCount);
void onViewerSettingsChanged();
void onColorManagementSystemChanged();
void updateMagnifierToolSettings();
void updateUndoRedoSettings();

View File

@ -70,6 +70,9 @@ void PDFViewerSettings::readSettings(QSettings& settings, const pdf::PDFCMSSetti
m_colorManagementSystemSettings.deviceGray = settings.value("deviceGray", defaultCMSSettings.deviceGray).toString();
m_colorManagementSystemSettings.deviceRGB = settings.value("deviceRGB", defaultCMSSettings.deviceRGB).toString();
m_colorManagementSystemSettings.deviceCMYK = settings.value("deviceCMYK", defaultCMSSettings.deviceCMYK).toString();
m_colorManagementSystemSettings.softProofingProfile = settings.value("softProofingProfile", defaultCMSSettings.softProofingProfile).toString();
m_colorManagementSystemSettings.proofingIntent = static_cast<pdf::RenderingIntent>(settings.value("proofingIntent", int(defaultCMSSettings.proofingIntent)).toInt());
m_colorManagementSystemSettings.outOfGamutColor = settings.value("outOfGamutColor", defaultCMSSettings.outOfGamutColor).value<QColor>();
m_colorManagementSystemSettings.profileDirectory = settings.value("profileDirectory", defaultCMSSettings.profileDirectory).toString();
settings.endGroup();
@ -131,6 +134,9 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
settings.setValue("deviceGray", m_colorManagementSystemSettings.deviceGray);
settings.setValue("deviceRGB", m_colorManagementSystemSettings.deviceRGB);
settings.setValue("deviceCMYK", m_colorManagementSystemSettings.deviceCMYK);
settings.setValue("softProofingProfile", m_colorManagementSystemSettings.softProofingProfile);
settings.setValue("proofingIntent", int(m_colorManagementSystemSettings.proofingIntent));
settings.setValue("outOfGamutColor", m_colorManagementSystemSettings.outOfGamutColor);
settings.setValue("profileDirectory", m_colorManagementSystemSettings.profileDirectory);
settings.endGroup();

View File

@ -40,6 +40,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, const pdf::PDFCMSSettings& setti
ui->cmsProofingIntentComboBox->setCurrentIndex(ui->cmsProofingIntentComboBox->findData(int(m_settings.proofingIntent)));
ui->cmsProofingColorProfileComboBox->setCurrentIndex(ui->cmsProofingColorProfileComboBox->findData(m_settings.softProofingProfile));
ui->outOfGamutColorEdit->setText(m_settings.outOfGamutColor.name(QColor::HexRgb));
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(320, 160)));
}
@ -53,6 +54,11 @@ void SettingsDialog::accept()
{
m_settings.proofingIntent = static_cast<pdf::RenderingIntent>(ui->cmsProofingIntentComboBox->currentData().toInt());
m_settings.softProofingProfile = ui->cmsProofingColorProfileComboBox->currentData().toString();
m_settings.outOfGamutColor.setNamedColor(ui->outOfGamutColorEdit->text());
if (!m_settings.outOfGamutColor.isValid())
{
m_settings.outOfGamutColor = Qt::red;
}
QDialog::accept();
}

View File

@ -20,27 +20,7 @@
<string>Soft Proofing Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="cmsOutputProfileLabel">
<property name="text">
<string>Proofing profile</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmsProofingColorProfileComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="cmsProofingIntentLabel">
<property name="text">
<string>Proofing intent</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cmsProofingIntentComboBox"/>
</item>
<item row="2" column="0">
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -53,6 +33,36 @@
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="cmsProofingIntentLabel">
<property name="text">
<string>Proofing intent</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="cmsProofingIntentComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="cmsOutputProfileLabel">
<property name="text">
<string>Proofing profile</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cmsProofingColorProfileComboBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="outOfGamutColorLabel">
<property name="text">
<string>Alarm color</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="outOfGamutColorEdit"/>
</item>
</layout>
</widget>
</item>