From 114dfcb89561d36c9b04779747fdce0b58e766d3 Mon Sep 17 00:00:00 2001 From: Jakub Melka Date: Thu, 18 Feb 2021 18:34:29 +0100 Subject: [PATCH] Bugfix: cmyk over spot color --- Pdf4QtLib/sources/pdftransparencyrenderer.cpp | 12 ++++++++++++ Pdf4QtLib/sources/pdftransparencyrenderer.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Pdf4QtLib/sources/pdftransparencyrenderer.cpp b/Pdf4QtLib/sources/pdftransparencyrenderer.cpp index b765229..a20ce99 100644 --- a/Pdf4QtLib/sources/pdftransparencyrenderer.cpp +++ b/Pdf4QtLib/sources/pdftransparencyrenderer.cpp @@ -148,6 +148,11 @@ void PDFFloatBitmap::setAllColorActive() std::fill(m_activeColorMask.begin(), m_activeColorMask.end(), PDFPixelFormat::getAllColorsMask()); } +void PDFFloatBitmap::setAllColorInactive() +{ + std::fill(m_activeColorMask.begin(), m_activeColorMask.end(), 0); +} + PDFFloatBitmap PDFFloatBitmap::extractProcessColors() const { PDFPixelFormat format = PDFPixelFormat::createFormat(m_format.getProcessColorChannelCount(), 0, false, m_format.hasProcessColorsSubtractive(), false); @@ -363,6 +368,12 @@ void PDFFloatBitmap::blend(const PDFFloatBitmap& source, continue; } + if (target.hasActiveColorMask()) + { + const uint32_t activeColorChannels = source.hasActiveColorMask() ? source.getPixelActiveColorMask(x, y) : PDFPixelFormat::getAllColorsMask(); + target.markPixelActiveColorMask(x, y, activeColorChannels); + } + std::fill(B_i.begin(), B_i.end(), 0.0f); // Calculate blended pixel @@ -2289,6 +2300,7 @@ void PDFTransparencyRenderer::PDFTransparencyGroupPainterData::makeInitialBackdr void PDFTransparencyRenderer::PDFTransparencyGroupPainterData::makeImmediateBackdropTransparent() { immediateBackdrop.makeTransparent(); + immediateBackdrop.setAllColorInactive(); } void PDFTransparencyRenderer::PDFTransparencyGroupPainterData::makeSoftMaskOpaque() diff --git a/Pdf4QtLib/sources/pdftransparencyrenderer.h b/Pdf4QtLib/sources/pdftransparencyrenderer.h index 9079e56..312ace6 100644 --- a/Pdf4QtLib/sources/pdftransparencyrenderer.h +++ b/Pdf4QtLib/sources/pdftransparencyrenderer.h @@ -205,6 +205,9 @@ public: /// Sets all colors as active void setAllColorActive(); + /// Sets all colors as inactive + void setAllColorInactive(); + /// Extract process colors into another bitmap PDFFloatBitmap extractProcessColors() const;