Skip to content

Commit

Permalink
Implement fill opacity for shading patterns in the SVG back-end
Browse files Browse the repository at this point in the history
In the PDF file from the issue below, the fill alpha (`ca`) is set
before drawing the circles using the `setGState` operator. Doing so
causes the global alpha to be set on the canvas' context for the canvas
back-end, but this was not handled in the SVG back-end. This patch fixes
that by taking the fill opacity into account when drawing shading
patterns in the same way as done elsewhere so it is only included if the
value is non-default.

Fixes #11812.
  • Loading branch information
timvandermeij committed May 24, 2020
1 parent 3b615e4 commit f14215d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/display/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,9 @@ if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
rect.setAttributeNS(null, "width", x1 - x0);
rect.setAttributeNS(null, "height", y1 - y0);
rect.setAttributeNS(null, "fill", this._makeShadingPattern(args));
if (this.current.fillAlpha < 1) {
rect.setAttributeNS(null, "fill-opacity", this.current.fillAlpha);
}
this._ensureTransformGroup().appendChild(rect);
}

Expand Down

0 comments on commit f14215d

Please sign in to comment.