mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
GUI adjustments, display settings
This commit is contained in:
@ -1169,6 +1169,53 @@ void PDFTransparencyRenderer::clearColor(const PDFColor& color)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PDFTransparencyRenderer::isContentKindSuppressed(ContentKind kind) const
|
||||||
|
{
|
||||||
|
switch (kind)
|
||||||
|
{
|
||||||
|
case ContentKind::Shapes:
|
||||||
|
if (!m_settings.flags.testFlag(PDFTransparencyRendererSettings::DisplayVectorGraphics))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ContentKind::Text:
|
||||||
|
if (!m_settings.flags.testFlag(PDFTransparencyRendererSettings::DisplayText))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ContentKind::Images:
|
||||||
|
if (!m_settings.flags.testFlag(PDFTransparencyRendererSettings::DisplayImages))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ContentKind::Shading:
|
||||||
|
if (!m_settings.flags.testFlag(PDFTransparencyRendererSettings::DisplayShadings))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ContentKind::Tiling:
|
||||||
|
if (!m_settings.flags.testFlag(PDFTransparencyRendererSettings::DisplayTilingPatterns))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BaseClass::isContentKindSuppressed(kind);
|
||||||
|
}
|
||||||
|
|
||||||
void PDFTransparencyRenderer::performPixelSampling(const PDFReal shape,
|
void PDFTransparencyRenderer::performPixelSampling(const PDFReal shape,
|
||||||
const PDFReal opacity,
|
const PDFReal opacity,
|
||||||
const uint8_t shapeChannel,
|
const uint8_t shapeChannel,
|
||||||
|
@ -587,12 +587,27 @@ struct PDFTransparencyRendererSettings
|
|||||||
/// images, which doesn't have Interpolate set to true,
|
/// images, which doesn't have Interpolate set to true,
|
||||||
/// fast image transformation is used.
|
/// fast image transformation is used.
|
||||||
SmoothImageTransformation = 0x0010,
|
SmoothImageTransformation = 0x0010,
|
||||||
|
|
||||||
|
/// Display images (if this flag is false, images aren't processed)
|
||||||
|
DisplayImages = 0x0020,
|
||||||
|
|
||||||
|
/// Display text (if this flag is false, text isnn't processed)
|
||||||
|
DisplayText = 0x0040,
|
||||||
|
|
||||||
|
/// Display vector graphics (if this flag is false, vector graphics isn't processed)
|
||||||
|
DisplayVectorGraphics = 0x0080,
|
||||||
|
|
||||||
|
/// Display shading patterns (if this flag is false, shading patterns aren't processed)
|
||||||
|
DisplayShadings = 0x0100,
|
||||||
|
|
||||||
|
/// Display tiling patterns (if this flag is false, tiling patterns aren't processed)
|
||||||
|
DisplayTilingPatterns = 0x0200,
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(Flags, Flag)
|
Q_DECLARE_FLAGS(Flags, Flag)
|
||||||
|
|
||||||
/// Flags
|
/// Flags
|
||||||
Flags flags = None;
|
Flags flags = DisplayImages | DisplayText | DisplayVectorGraphics | DisplayShadings | DisplayTilingPatterns;
|
||||||
|
|
||||||
/// Active color mask
|
/// Active color mask
|
||||||
uint32_t activeColorMask = PDFPixelFormat::getAllColorsMask();
|
uint32_t activeColorMask = PDFPixelFormat::getAllColorsMask();
|
||||||
@ -656,6 +671,7 @@ public:
|
|||||||
/// \param color Color
|
/// \param color Color
|
||||||
void clearColor(const PDFColor& color);
|
void clearColor(const PDFColor& color);
|
||||||
|
|
||||||
|
virtual bool isContentKindSuppressed(ContentKind kind) const override;
|
||||||
virtual void performPathPainting(const QPainterPath& path, bool stroke, bool fill, bool text, Qt::FillRule fillRule) override;
|
virtual void performPathPainting(const QPainterPath& path, bool stroke, bool fill, bool text, Qt::FillRule fillRule) override;
|
||||||
virtual bool performPathPaintingUsingShading(const QPainterPath& path, bool stroke, bool fill, const PDFShadingPattern* shadingPattern) override;
|
virtual bool performPathPaintingUsingShading(const QPainterPath& path, bool stroke, bool fill, const PDFShadingPattern* shadingPattern) override;
|
||||||
virtual void performFinishPathPainting() override;
|
virtual void performFinishPathPainting() override;
|
||||||
|
@ -44,6 +44,12 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
|||||||
ui->pageIndexScrollBar->setValue(1);
|
ui->pageIndexScrollBar->setValue(1);
|
||||||
ui->pageIndexScrollBar->setMaximum(int(document->getCatalog()->getPageCount()));
|
ui->pageIndexScrollBar->setMaximum(int(document->getCatalog()->getPageCount()));
|
||||||
|
|
||||||
|
ui->displayModeComboBox->addItem(tr("Separations"), Separations);
|
||||||
|
ui->displayModeComboBox->addItem(tr("Color Warnings | Ink Coverage"), ColorWarningInkCoverage);
|
||||||
|
ui->displayModeComboBox->addItem(tr("Color Warnings | Rich Black"), ColorWarningRichBlack);
|
||||||
|
ui->displayModeComboBox->addItem(tr("Ink Coverage"), InkCoverage);
|
||||||
|
ui->displayModeComboBox->setCurrentIndex(0);
|
||||||
|
|
||||||
m_inkMapper.createSpotColors(ui->simulateSeparationsCheckBox->isChecked());
|
m_inkMapper.createSpotColors(ui->simulateSeparationsCheckBox->isChecked());
|
||||||
connect(ui->simulateSeparationsCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::onSimulateSeparationsChecked);
|
connect(ui->simulateSeparationsCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::onSimulateSeparationsChecked);
|
||||||
connect(ui->simulatePaperColorCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::onSimulatePaperColorChecked);
|
connect(ui->simulatePaperColorCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::onSimulatePaperColorChecked);
|
||||||
@ -51,6 +57,11 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
|||||||
connect(ui->greenPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
|
connect(ui->greenPaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
|
||||||
connect(ui->bluePaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
|
connect(ui->bluePaperColorEdit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &OutputPreviewDialog::onPaperColorChanged);
|
||||||
connect(ui->pageIndexScrollBar, &QScrollBar::valueChanged, this, &OutputPreviewDialog::updatePageImage);
|
connect(ui->pageIndexScrollBar, &QScrollBar::valueChanged, this, &OutputPreviewDialog::updatePageImage);
|
||||||
|
connect(ui->displayImagesCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::updatePageImage);
|
||||||
|
connect(ui->displayShadingCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::updatePageImage);
|
||||||
|
connect(ui->displayTextCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::updatePageImage);
|
||||||
|
connect(ui->displayTilingPatternsCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::updatePageImage);
|
||||||
|
connect(ui->displayVectorGraphicsCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::updatePageImage);
|
||||||
connect(ui->inksTreeWidget->model(), &QAbstractItemModel::dataChanged, this, &OutputPreviewDialog::onInksChanged);
|
connect(ui->inksTreeWidget->model(), &QAbstractItemModel::dataChanged, this, &OutputPreviewDialog::onInksChanged);
|
||||||
|
|
||||||
updatePageImage();
|
updatePageImage();
|
||||||
@ -238,11 +249,18 @@ void OutputPreviewDialog::updatePageImage()
|
|||||||
paperColor[2] = ui->bluePaperColorEdit->value();
|
paperColor[2] = ui->bluePaperColorEdit->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pdf::PDFTransparencyRendererSettings::Flags flags = pdf::PDFTransparencyRendererSettings::None;
|
||||||
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::DisplayImages, ui->displayImagesCheckBox->isChecked());
|
||||||
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::DisplayText, ui->displayTextCheckBox->isChecked());
|
||||||
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::DisplayVectorGraphics, ui->displayVectorGraphicsCheckBox->isChecked());
|
||||||
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::DisplayShadings, ui->displayShadingCheckBox->isChecked());
|
||||||
|
flags.setFlag(pdf::PDFTransparencyRendererSettings::DisplayTilingPatterns, ui->displayTilingPatternsCheckBox->isChecked());
|
||||||
|
|
||||||
m_inkMapperForRendering = m_inkMapper;
|
m_inkMapperForRendering = m_inkMapper;
|
||||||
QSize renderSize = ui->imageLabel->size();
|
QSize renderSize = ui->imageLabel->size();
|
||||||
auto renderImage = [this, page, renderSize, paperColor, activeColorMask]() -> RenderedImage
|
auto renderImage = [this, page, renderSize, paperColor, activeColorMask, flags]() -> RenderedImage
|
||||||
{
|
{
|
||||||
return renderPage(page, renderSize, paperColor, activeColorMask);
|
return renderPage(page, renderSize, paperColor, activeColorMask, flags);
|
||||||
};
|
};
|
||||||
|
|
||||||
m_future = QtConcurrent::run(renderImage);
|
m_future = QtConcurrent::run(renderImage);
|
||||||
@ -251,7 +269,11 @@ void OutputPreviewDialog::updatePageImage()
|
|||||||
m_futureWatcher->setFuture(m_future);
|
m_futureWatcher->setFuture(m_future);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputPreviewDialog::RenderedImage OutputPreviewDialog::renderPage(const pdf::PDFPage* page, QSize renderSize, pdf::PDFRGB paperColor, uint32_t activeColorMask)
|
OutputPreviewDialog::RenderedImage OutputPreviewDialog::renderPage(const pdf::PDFPage* page,
|
||||||
|
QSize renderSize,
|
||||||
|
pdf::PDFRGB paperColor,
|
||||||
|
uint32_t activeColorMask,
|
||||||
|
pdf::PDFTransparencyRendererSettings::Flags additionalFlags)
|
||||||
{
|
{
|
||||||
RenderedImage result;
|
RenderedImage result;
|
||||||
|
|
||||||
@ -266,6 +288,7 @@ OutputPreviewDialog::RenderedImage OutputPreviewDialog::renderPage(const pdf::PD
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdf::PDFTransparencyRendererSettings settings;
|
pdf::PDFTransparencyRendererSettings settings;
|
||||||
|
settings.flags = additionalFlags;
|
||||||
|
|
||||||
// Jakub Melka: debug is very slow, use multithreading
|
// Jakub Melka: debug is very slow, use multithreading
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
|
@ -51,6 +51,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
enum DisplayMode
|
||||||
|
{
|
||||||
|
Separations,
|
||||||
|
ColorWarningInkCoverage,
|
||||||
|
ColorWarningRichBlack,
|
||||||
|
InkCoverage
|
||||||
|
};
|
||||||
|
|
||||||
void updateInks();
|
void updateInks();
|
||||||
void updatePaperColorWidgets();
|
void updatePaperColorWidgets();
|
||||||
|
|
||||||
@ -67,7 +75,11 @@ private:
|
|||||||
|
|
||||||
void updatePageImage();
|
void updatePageImage();
|
||||||
void onPageImageRendered();
|
void onPageImageRendered();
|
||||||
RenderedImage renderPage(const pdf::PDFPage* page, QSize renderSize, pdf::PDFRGB paperColor, uint32_t activeColorMask);
|
RenderedImage renderPage(const pdf::PDFPage* page,
|
||||||
|
QSize renderSize,
|
||||||
|
pdf::PDFRGB paperColor,
|
||||||
|
uint32_t activeColorMask,
|
||||||
|
pdf::PDFTransparencyRendererSettings::Flags additionalFlags);
|
||||||
bool isRenderingDone() const;
|
bool isRenderingDone() const;
|
||||||
|
|
||||||
Ui::OutputPreviewDialog* ui;
|
Ui::OutputPreviewDialog* ui;
|
||||||
|
@ -6,15 +6,15 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>852</width>
|
<width>955</width>
|
||||||
<height>503</height>
|
<height>677</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Output Preview</string>
|
<string>Output Preview</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="outputPreviewDialogLayout">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1">
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="3,1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="frame">
|
<widget class="QFrame" name="frame">
|
||||||
@ -145,6 +145,144 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="displayGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Display</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="displayImagesCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Images</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="displayTextCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Text</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="displayVectorGraphicsCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Vector graphics</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="displayShadingCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Shading patterns</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="displayTilingPatternsCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tiling patterns</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+S</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="displayModeComboBox"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="colorWarningsGroupBox">
|
||||||
|
<property name="title">
|
||||||
|
<string>Color Warnings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="alarmColorLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Alarm color</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="inkCoverageLimitEdit">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> %</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>300.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="coverageLimitLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Coverage limit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="alarmColorButton">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QDoubleSpinBox" name="richBlackLimitEdit">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> %</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>10.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="richBlackLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Rich black limit</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="inksGroupBox">
|
<widget class="QGroupBox" name="inksGroupBox">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -170,7 +308,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="1" column="0">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
|
Reference in New Issue
Block a user