diff --git a/Pdf4QtLib/sources/pdfcms.cpp b/Pdf4QtLib/sources/pdfcms.cpp
index ace9b93..567ec6a 100644
--- a/Pdf4QtLib/sources/pdfcms.cpp
+++ b/Pdf4QtLib/sources/pdfcms.cpp
@@ -1457,7 +1457,14 @@ void PDFCMSManager::setSettings(const PDFCMSSettings& settings)
PDFColorConvertor PDFCMSManager::getColorConvertor() const
{
- return PDFColorConvertor();
+ QMutexLocker lock(&m_mutex);
+
+ PDFColorConvertor colorConvertor;
+ colorConvertor.setBackgroundColor(m_settings.backgroundColor);
+ colorConvertor.setForegroundColor(m_settings.foregroundColor);
+ colorConvertor.setHighContrastBrightnessFactor(m_settings.sigmoidSlopeFactor);
+ colorConvertor.setBitonalThreshold(m_settings.bitonalThreshold);
+ return colorConvertor;
}
const PDFColorProfileIdentifiers& PDFCMSManager::getOutputProfiles() const
diff --git a/Pdf4QtLib/sources/pdfcms.h b/Pdf4QtLib/sources/pdfcms.h
index a056c63..3686c3b 100644
--- a/Pdf4QtLib/sources/pdfcms.h
+++ b/Pdf4QtLib/sources/pdfcms.h
@@ -84,6 +84,12 @@ struct PDFCMSSettings
QString deviceCMYK; ///< Identifiers for color space (device CMYK)
QString softProofingProfile; ///< Identifiers for soft proofing profile
QString profileDirectory; ///< Directory containing color profiles
+
+ // Postprocessing
+ QColor foregroundColor = Qt::green;
+ QColor backgroundColor = Qt::black;
+ int bitonalThreshold = 128;
+ double sigmoidSlopeFactor = 10.0;
};
/// Color management system base class. It contains functions to transform
diff --git a/Pdf4QtLib/sources/pdfcolorconvertor.cpp b/Pdf4QtLib/sources/pdfcolorconvertor.cpp
index 8b054ff..ce0d0e0 100644
--- a/Pdf4QtLib/sources/pdfcolorconvertor.cpp
+++ b/Pdf4QtLib/sources/pdfcolorconvertor.cpp
@@ -197,6 +197,26 @@ void PDFColorConvertor::calculateSigmoidParams()
m_sigmoidParamC_Range = sigmoidParamC_Range();
}
+QColor PDFColorConvertor::getForegroundColor() const
+{
+ return m_foregroundColor;
+}
+
+QColor PDFColorConvertor::getBackgroundColor() const
+{
+ return m_backgroundColor;
+}
+
+void PDFColorConvertor::setForegroundColor(const QColor& newForegroundColor)
+{
+ m_foregroundColor = newForegroundColor;
+}
+
+void PDFColorConvertor::setBackgroundColor(const QColor& newBackgroundColor)
+{
+ m_backgroundColor = newBackgroundColor;
+}
+
int PDFColorConvertor::getBitonalThreshold() const
{
return m_bitonalThreshold;
diff --git a/Pdf4QtLib/sources/pdfcolorconvertor.h b/Pdf4QtLib/sources/pdfcolorconvertor.h
index 71e4629..6a37788 100644
--- a/Pdf4QtLib/sources/pdfcolorconvertor.h
+++ b/Pdf4QtLib/sources/pdfcolorconvertor.h
@@ -92,6 +92,17 @@ public:
/// to ensure accurate differentiation between light and dark areas in images.
void setBitonalThreshold(int newBitonalThreshold);
+ /// Set background color
+ /// \param newBackgroundColor Background color
+ void setBackgroundColor(const QColor& newBackgroundColor);
+
+ /// Set foreground color
+ /// \param newForegroundColor Foreground color
+ void setForegroundColor(const QColor& newForegroundColor);
+
+ QColor getBackgroundColor() const;
+ QColor getForegroundColor() const;
+
private:
/// Correct lightness using sigmoid function
/// \return Adjusted lightness normalized in range [0.0, 1.0]
diff --git a/Pdf4QtViewer/pdfviewermainwindowlite.cpp b/Pdf4QtViewer/pdfviewermainwindowlite.cpp
index a5d7a9e..e5bdc65 100644
--- a/Pdf4QtViewer/pdfviewermainwindowlite.cpp
+++ b/Pdf4QtViewer/pdfviewermainwindowlite.cpp
@@ -120,7 +120,11 @@ PDFViewerMainWindowLite::PDFViewerMainWindowLite(QWidget* parent) :
m_actionManager->setAction(PDFActionManager::RenderOptionSmoothPictures, ui->actionRenderOptionSmoothPictures);
m_actionManager->setAction(PDFActionManager::RenderOptionIgnoreOptionalContentSettings, ui->actionRenderOptionIgnoreOptionalContentSettings);
m_actionManager->setAction(PDFActionManager::RenderOptionDisplayAnnotations, ui->actionRenderOptionDisplayAnnotations);
- m_actionManager->setAction(PDFActionManager::RenderOptionInvertColors, ui->actionInvertColors);
+ m_actionManager->setAction(PDFActionManager::RenderOptionInvertColors, ui->actionColorInvert);
+ m_actionManager->setAction(PDFActionManager::RenderOptionGrayscale, ui->actionColorGrayscale);
+ m_actionManager->setAction(PDFActionManager::RenderOptionHighContrast, ui->actionColorHighContrast);
+ m_actionManager->setAction(PDFActionManager::RenderOptionBitonal, ui->actionColorBitonal);
+ m_actionManager->setAction(PDFActionManager::RenderOptionCustomColors, ui->actionColorCustom);
m_actionManager->setAction(PDFActionManager::Properties, ui->actionProperties);
m_actionManager->setAction(PDFActionManager::Options, ui->actionOptions);
m_actionManager->setAction(PDFActionManager::ResetToFactorySettings, ui->actionResetToFactorySettings);
diff --git a/Pdf4QtViewer/pdfviewermainwindowlite.ui b/Pdf4QtViewer/pdfviewermainwindowlite.ui
index 81860bf..a5b8e7c 100644
--- a/Pdf4QtViewer/pdfviewermainwindowlite.ui
+++ b/Pdf4QtViewer/pdfviewermainwindowlite.ui
@@ -87,7 +87,11 @@
-
+
+
+
+
+
+
+
+ -
+
+
+ Color Postprocessing
+
+
+
-
+
+
-
+
+
+ -
+
+
+ Sigmoid function slope parameter
+
+
+
+ -
+
+
+ Foreground color
+
+
+
+ -
+
+
+ -
+
+
+ Background color
+
+
+
+ -
+
+
+ 1.000000000000000
+
+
+ 100.000000000000000
+
+
+
+ -
+
+
+ Bitonal threshold
+
+
+
+ -
+
+
+ 255
+
+
+
+
+
+ -
+
+
+ <html><head/><body><p><span style=" font-weight:700;">Foreground</span> and <span style=" font-weight:700;">background</span> colors refer to a custom colors rendering mode, where two colors are used - the paper is drawn with the background color, and the foreground color is used for text and graphics. By default, the background is black and the foreground is green, which is easy on the eyes. </p><p><span style=" font-weight:700;">Sigmoid function slope parameter</span> is a parameter in high contrast color rendering. This rendering mode displays all graphics in high contrast. This parameter affects the degree of contrast. Set the value from 1 to 5 for a small contrast change, from 5 to 10 for a medium contrast change, and more than 10 for very high contrast rendering. </p><p><span style=" font-weight:700;">Bitonal threshold</span> is used in the bitonal rendering color mode. It distinguishes between black and white colors. However, the threshold for images is determined automatically. </p></body></html>
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+