summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpdf.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-01 01:01:28 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-11-01 01:01:28 +0100
commitf09fc1f35294827245e74ced48274387d5ed346f (patch)
tree4c07e40a13fd5be82f2afe4a38165b46dd385d34 /src/gui/painting/qpdf.cpp
parentcc9645f11b46aaad36658d62d38a5e44a5ba5ae5 (diff)
parentf5c0a19077989b5ac14071ecd095e29f62d05602 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'src/gui/painting/qpdf.cpp')
-rw-r--r--src/gui/painting/qpdf.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 6cabf3ccae..0811dd9918 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -954,7 +954,18 @@ void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, con
if (object < 0)
return;
- *d->currentPage << "q\n/GSa gs\n";
+ *d->currentPage << "q\n";
+
+ if ((d->pdfVersion != QPdfEngine::Version_A1b) && (d->opacity != 1.0)) {
+ int stateObject = d->addConstantAlphaObject(qRound(255 * d->opacity), qRound(255 * d->opacity));
+ if (stateObject)
+ *d->currentPage << "/GState" << stateObject << "gs\n";
+ else
+ *d->currentPage << "/GSa gs\n";
+ } else {
+ *d->currentPage << "/GSa gs\n";
+ }
+
*d->currentPage
<< QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(),
rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix));
@@ -983,7 +994,18 @@ void QPdfEngine::drawImage(const QRectF &rectangle, const QImage &image, const Q
if (object < 0)
return;
- *d->currentPage << "q\n/GSa gs\n";
+ *d->currentPage << "q\n";
+
+ if ((d->pdfVersion != QPdfEngine::Version_A1b) && (d->opacity != 1.0)) {
+ int stateObject = d->addConstantAlphaObject(qRound(255 * d->opacity), qRound(255 * d->opacity));
+ if (stateObject)
+ *d->currentPage << "/GState" << stateObject << "gs\n";
+ else
+ *d->currentPage << "/GSa gs\n";
+ } else {
+ *d->currentPage << "/GSa gs\n";
+ }
+
*d->currentPage
<< QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(),
rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix));