sdext/qa/unit/pdfimport.cxx | 7 +++++ sdext/source/pdfimport/inc/contentsink.hxx | 2 + sdext/source/pdfimport/inc/pdfiprocessor.hxx | 3 ++ sdext/source/pdfimport/tree/pdfiprocessor.cxx | 8 ++++++ sdext/source/pdfimport/wrapper/keyword_list | 4 ++- sdext/source/pdfimport/wrapper/wrapper.cxx | 20 ++++++++++++++++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 22 ++++++++++++++++++ sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 11 +++++++++ 8 files changed, 76 insertions(+), 1 deletion(-)
New commits: commit 56d8b1a916d82df3a8ad32ed4c8f65c3b8c78d45 Author: Dr. David Alan Gilbert <d...@treblig.org> AuthorDate: Sat Jul 26 01:28:48 2025 +0100 Commit: David Gilbert <d...@treblig.org> CommitDate: Sat Aug 9 14:59:55 2025 +0200 tdf#44729 sdext,pdfimport: Route transparency group down Route the calls from the wrapper down to the pdfiprocessor layer. Change-Id: I646adf4acc884cccecd08da6fcdca4cfa8841954 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188453 Tested-by: Jenkins Reviewed-by: David Gilbert <freedesk...@treblig.org> diff --git a/sdext/qa/unit/pdfimport.cxx b/sdext/qa/unit/pdfimport.cxx index 68a9b7580b26..4adb28e694e2 100644 --- a/sdext/qa/unit/pdfimport.cxx +++ b/sdext/qa/unit/pdfimport.cxx @@ -442,6 +442,13 @@ namespace { } + virtual void beginTransparencyGroup(bool) override + { + } + virtual void endTransparencyGroup(void) override + { + } + typedef std::unordered_map<sal_Int32,FontAttributes> IdToFontMap; typedef std::unordered_map<FontAttributes,sal_Int32,FontAttrHash> FontToIdMap; diff --git a/sdext/source/pdfimport/inc/contentsink.hxx b/sdext/source/pdfimport/inc/contentsink.hxx index 8e93d9a1467b..46f34544bc92 100644 --- a/sdext/source/pdfimport/inc/contentsink.hxx +++ b/sdext/source/pdfimport/inc/contentsink.hxx @@ -178,6 +178,8 @@ namespace pdfi int nPaintType, css::geometry::AffineMatrix2D& rMat, const css::uno::Sequence<css::beans::PropertyValue>& xTile) = 0; + virtual void beginTransparencyGroup(bool bForSoftMask) = 0; + virtual void endTransparencyGroup(void) = 0; }; typedef std::shared_ptr<ContentSink> ContentSinkSharedPtr; diff --git a/sdext/source/pdfimport/inc/pdfiprocessor.hxx b/sdext/source/pdfimport/inc/pdfiprocessor.hxx index 29a73262dd25..18c957e3ed1b 100644 --- a/sdext/source/pdfimport/inc/pdfiprocessor.hxx +++ b/sdext/source/pdfimport/inc/pdfiprocessor.hxx @@ -158,6 +158,9 @@ namespace pdfi css::geometry::AffineMatrix2D& rMat, const css::uno::Sequence<css::beans::PropertyValue>& xTile) override; + virtual void beginTransparencyGroup(bool bForSoftMask) override; + virtual void endTransparencyGroup(void) override; + void startIndicator( const OUString& rText ); void endIndicator(); diff --git a/sdext/source/pdfimport/tree/pdfiprocessor.cxx b/sdext/source/pdfimport/tree/pdfiprocessor.cxx index 5fa7984b6303..a28b51c37564 100644 --- a/sdext/source/pdfimport/tree/pdfiprocessor.cxx +++ b/sdext/source/pdfimport/tree/pdfiprocessor.cxx @@ -585,6 +585,14 @@ void PDFIProcessor::intersectClipToStroke(const uno::Reference< rendering::XPoly getCurrentContext().Clip = std::move(aNewClip); } +void PDFIProcessor::beginTransparencyGroup(const bool /*bForSoftMask*/) +{ +} + +void PDFIProcessor::endTransparencyGroup() +{ +} + void PDFIProcessor::hyperLink( const geometry::RealRectangle2D& rBounds, const OUString& rURI ) { diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index a662791aa4d5..3863691592cb 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -854,15 +854,14 @@ void LineParser::readTilingPatternFill() void LineParser::beginTransparencyGroup() { - // TODO sal_Int32 nForSoftMask; readInt32( nForSoftMask ); + m_parser.m_pSink->beginTransparencyGroup(!!nForSoftMask); } void LineParser::endTransparencyGroup() { - // TODO - dummy to avoid static warning until next patch - m_nCharIndex = std::string_view::npos; + m_parser.m_pSink->endTransparencyGroup(); } void Parser::parseLine( std::string_view aLine ) commit f365a63a4ade102edcaab4fb14b942f169bbd26e Author: Dr. David Alan Gilbert <d...@treblig.org> AuthorDate: Fri Jul 25 02:39:58 2025 +0100 Commit: David Gilbert <d...@treblig.org> CommitDate: Sat Aug 9 14:59:43 2025 +0200 tdf#44729 sdext,pdfimport: Pass begin/end Transparency Group Pass the begin/end of transparency groups down from the wrapper, for now just with the 'forSoftMask' flag. Change-Id: Id3f69a943a16166106ce23cb600cc85c26c505ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188452 Tested-by: Jenkins Reviewed-by: David Gilbert <freedesk...@treblig.org> diff --git a/sdext/source/pdfimport/wrapper/keyword_list b/sdext/source/pdfimport/wrapper/keyword_list index 28a5c3184105..0432d9e4aa3d 100644 --- a/sdext/source/pdfimport/wrapper/keyword_list +++ b/sdext/source/pdfimport/wrapper/keyword_list @@ -5,16 +5,18 @@ struct hash_entry { int name; enum parseKey eKey; }; #endif %% +beginTransparencyGroup,BEGINTRANSPARENCYGROUP clipPath,CLIPPATH clipToStrokePath,CLIPTOSTROKEPATH drawChar,DRAWCHAR drawImage,DRAWIMAGE -drawLink,DRAWLINK +drawLink,DRAWLINK drawMask,DRAWMASK drawMaskedImage,DRAWMASKEDIMAGE drawSoftMaskedImage,DRAWSOFTMASKEDIMAGE endPage,ENDPAGE endTextObject,ENDTEXTOBJECT +endTransparencyGroup,ENDTRANSPARENCYGROUP eoClipPath,EOCLIPPATH eoFillPath,EOFILLPATH fillPath,FILLPATH diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 5c9ec116dec7..a662791aa4d5 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -74,6 +74,7 @@ namespace // identifier of the strings coming from the out-of-process xpdf // converter enum parseKey { + BEGINTRANSPARENCYGROUP, CLIPPATH, CLIPTOSTROKEPATH, DRAWCHAR, @@ -84,6 +85,7 @@ enum parseKey { DRAWSOFTMASKEDIMAGE, ENDPAGE, ENDTEXTOBJECT, + ENDTRANSPARENCYGROUP, EOCLIPPATH, EOFILLPATH, FILLPATH, @@ -198,6 +200,8 @@ public: void readMaskedImage(); void readSoftMaskedImage(); void readTilingPatternFill(); + void beginTransparencyGroup(); + void endTransparencyGroup(); }; /** Unescapes line-ending characters in input string. These @@ -848,6 +852,19 @@ void LineParser::readTilingPatternFill() aTile ); } +void LineParser::beginTransparencyGroup() +{ + // TODO + sal_Int32 nForSoftMask; + readInt32( nForSoftMask ); +} + +void LineParser::endTransparencyGroup() +{ + // TODO - dummy to avoid static warning until next patch + m_nCharIndex = std::string_view::npos; +} + void Parser::parseLine( std::string_view aLine ) { OSL_PRECOND( m_pSink, "Invalid sink" ); @@ -861,6 +878,8 @@ void Parser::parseLine( std::string_view aLine ) assert(pEntry); switch( pEntry->eKey ) { + case BEGINTRANSPARENCYGROUP: + lp.beginTransparencyGroup(); break; case CLIPPATH: m_pSink->intersectClip(lp.readPath()); break; case CLIPTOSTROKEPATH: @@ -881,6 +900,8 @@ void Parser::parseLine( std::string_view aLine ) m_pSink->endPage(); break; case ENDTEXTOBJECT: m_pSink->endText(); break; + case ENDTRANSPARENCYGROUP: + lp.endTransparencyGroup(); break; case EOCLIPPATH: m_pSink->intersectEoClip(lp.readPath()); break; case EOFILLPATH: diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index c15078640ce5..392a5b3ee426 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -1137,6 +1137,28 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, writeBinaryBuffer(aBuf); } +#if POPPLER_CHECK_VERSION(0, 70, 0) +void PDFOutDev::beginTransparencyGroup(GfxState * /*state*/, const double * /*bbox*/, +#else +void PDFOutDev::beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/, +#endif + GfxColorSpace * /*blendingColorSpace*/, + poppler_bool /*isolated*/, + poppler_bool /*knockout*/, + poppler_bool forSoftMask) +{ + // We're not doing full transparency group yet, just trying to hide the + // soft mask temporaries. + printf( "beginTransparencyGroup %d", !!forSoftMask); + printf(" "); +} + +void PDFOutDev::endTransparencyGroup(GfxState * /* state */) +{ + printf( "endTransparencyGroup"); + printf(" "); +} + #if POPPLER_CHECK_VERSION(0, 82, 0) void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, int width, int height, GfxImageColorMap* colorMap, diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx index 051b6ab51206..e3c9533c6fe4 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx @@ -301,6 +301,17 @@ namespace pdfi int x0, int y0, int x1, int y1, double xStep, double yStep) override; #endif + +#if POPPLER_CHECK_VERSION(0, 70, 0) + void beginTransparencyGroup(GfxState *state, const double *bbox, +#else + void beginTransparencyGroup(GfxState *state, double *bbox, +#endif + GfxColorSpace *blendingColorSpace, + poppler_bool isolated, + poppler_bool knockout, + poppler_bool forSoftMask) override; + void endTransparencyGroup(GfxState *state) override; }; }