diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 07d95b3..c6cef4f 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -2283,6 +2283,7 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, xi0, yi0, xi1, yi1, xstep, ystep)) { goto restore; } else { + out->updatePatternOpacity(state); for (yi = yi0; yi < yi1; ++yi) { for (xi = xi0; xi < xi1; ++xi) { x = xi * xstep; @@ -2293,6 +2294,7 @@ void Gfx::doTilingPatternFill(GfxTilingPattern *tPat, m1, tPat->getBBox()); } } + out->clearPatternOpacity(state); } // restore graphics state diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h index e8a7a47..1c7da88 100644 --- a/poppler/OutputDev.h +++ b/poppler/OutputDev.h @@ -185,6 +185,8 @@ public: virtual void updateBlendMode(GfxState * /*state*/) {} virtual void updateFillOpacity(GfxState * /*state*/) {} virtual void updateStrokeOpacity(GfxState * /*state*/) {} + virtual void updatePatternOpacity(GfxState * /*state*/) {} + virtual void clearPatternOpacity(GfxState * /*state*/) {} virtual void updateFillOverprint(GfxState * /*state*/) {} virtual void updateStrokeOverprint(GfxState * /*state*/) {} virtual void updateOverprintMode(GfxState * /*state*/) {} diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 6d41616..d2827d1 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -1842,6 +1842,14 @@ void SplashOutputDev::updateStrokeOpacity(GfxState *state) { } } +void SplashOutputDev::updatePatternOpacity(GfxState *state) { + splash->setPatternAlpha((SplashCoord)state->getStrokeOpacity(), (SplashCoord)state->getFillOpacity()); +} + +void SplashOutputDev::clearPatternOpacity(GfxState *state) { + splash->clearPatternAlpha(); +} + void SplashOutputDev::updateFillOverprint(GfxState *state) { splash->setFillOverprint(state->getFillOverprint()); } diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index d34426c..ce4082f 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -231,6 +231,8 @@ public: virtual void updateBlendMode(GfxState *state); virtual void updateFillOpacity(GfxState *state); virtual void updateStrokeOpacity(GfxState *state); + virtual void updatePatternOpacity(GfxState *state); + virtual void clearPatternOpacity(GfxState *state); virtual void updateFillOverprint(GfxState *state); virtual void updateStrokeOverprint(GfxState *state); virtual void updateOverprintMode(GfxState *state); diff --git a/splash/Splash.cc b/splash/Splash.cc index 7453822..5bc7767 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -1752,11 +1752,23 @@ void Splash::setBlendFunc(SplashBlendFunc func) { } void Splash::setStrokeAlpha(SplashCoord alpha) { - state->strokeAlpha = alpha; + state->strokeAlpha = (state->multiplyPatternAlpha) ? alpha * state->patternStrokeAlpha : alpha; } void Splash::setFillAlpha(SplashCoord alpha) { - state->fillAlpha = alpha; + state->fillAlpha = (state->multiplyPatternAlpha) ? alpha * state->patternFillAlpha : alpha; +} + +void Splash::setPatternAlpha(SplashCoord strokeAlpha, SplashCoord fillAlpha) { + state->patternStrokeAlpha = strokeAlpha; + state->patternFillAlpha = fillAlpha; + state->multiplyPatternAlpha = gTrue; +} + +void Splash::clearPatternAlpha() { + state->patternStrokeAlpha = 1; + state->patternFillAlpha = 1; + state->multiplyPatternAlpha = gFalse; } void Splash::setFillOverprint(GBool fop) { diff --git a/splash/Splash.h b/splash/Splash.h index 7576454..3ca15c3 100644 --- a/splash/Splash.h +++ b/splash/Splash.h @@ -129,6 +129,8 @@ public: void setBlendFunc(SplashBlendFunc func); void setStrokeAlpha(SplashCoord alpha); void setFillAlpha(SplashCoord alpha); + void setPatternAlpha(SplashCoord strokeAlpha, SplashCoord fillAlpha); + void clearPatternAlpha(); void setFillOverprint(GBool fop); void setStrokeOverprint(GBool sop); void setOverprintMode(int opm); diff --git a/splash/SplashState.cc b/splash/SplashState.cc index fd2789d..bf417d6 100644 --- a/splash/SplashState.cc +++ b/splash/SplashState.cc @@ -59,6 +59,9 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, blendFunc = NULL; strokeAlpha = 1; fillAlpha = 1; + multiplyPatternAlpha = gFalse; + patternStrokeAlpha = 1; + patternFillAlpha = 1; lineWidth = 0; lineCap = splashLineCapButt; lineJoin = splashLineJoinMiter; @@ -109,6 +112,9 @@ SplashState::SplashState(int width, int height, GBool vectorAntialias, blendFunc = NULL; strokeAlpha = 1; fillAlpha = 1; + multiplyPatternAlpha = gFalse; + patternStrokeAlpha = 1; + patternFillAlpha = 1; lineWidth = 0; lineCap = splashLineCapButt; lineJoin = splashLineJoinMiter; @@ -152,6 +158,9 @@ SplashState::SplashState(SplashState *state) { blendFunc = state->blendFunc; strokeAlpha = state->strokeAlpha; fillAlpha = state->fillAlpha; + multiplyPatternAlpha = state->multiplyPatternAlpha; + patternStrokeAlpha = state->patternStrokeAlpha; + patternFillAlpha = state->patternFillAlpha; lineWidth = state->lineWidth; lineCap = state->lineCap; lineJoin = state->lineJoin; diff --git a/splash/SplashState.h b/splash/SplashState.h index 2c60353..deb679c 100644 --- a/splash/SplashState.h +++ b/splash/SplashState.h @@ -101,6 +101,9 @@ private: SplashBlendFunc blendFunc; SplashCoord strokeAlpha; SplashCoord fillAlpha; + GBool multiplyPatternAlpha; + SplashCoord patternStrokeAlpha; + SplashCoord patternFillAlpha; SplashCoord lineWidth; int lineCap; int lineJoin;