You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2016/10/07 17:30:22 UTC
svn commit: r1763806 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Author: tilman
Date: Fri Oct 7 17:30:22 2016
New Revision: 1763806
URL: http://svn.apache.org/viewvc?rev=1763806&view=rev
Log:
PDFBOX-3000: flip transparency group image when rendering it in the first level of a tiling pattern
Modified:
pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java?rev=1763806&r1=1763805&r2=1763806&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java Fri Oct 7 17:30:22 2016
@@ -94,6 +94,10 @@ public class PageDrawer extends PDFGraph
private PDRectangle pageSize;
private int pageRotation;
+
+ // whether image of a transparency group must be flipped
+ // needed when in a tiling pattern
+ private boolean flipTG = false;
// clipping winding rule used for the clipping path
private int clipWindingRule = -1;
@@ -213,10 +217,14 @@ public class PageDrawer extends PDFGraph
Area oldLastClip = lastClip;
lastClip = null;
+
+ boolean oldFlipTG = flipTG;
+ flipTG = true;
setRenderingHints();
processTilingPattern(pattern, color, colorSpace, patternMatrix);
-
+
+ flipTG = oldFlipTG;
graphics = oldGraphics;
linePath = oldLinePath;
lastClip = oldLastClip;
@@ -1064,6 +1072,12 @@ public class PageDrawer extends PDFGraph
// adjust (x,y) at the initial scale + cropbox
graphics.translate((x - pageSize.getLowerLeftX()) * xScale, (y + pageSize.getLowerLeftY()) * yScale);
+ if (flipTG)
+ {
+ graphics.translate(0, group.getImage().getHeight());
+ graphics.scale(1, -1);
+ }
+
PDSoftMask softMask = getGraphicsState().getSoftMask();
if (softMask != null)
{
@@ -1147,6 +1161,9 @@ public class PageDrawer extends PDFGraph
g.translate(0, image.getHeight());
g.scale(1, -1);
+ boolean oldFlipTG = flipTG;
+ flipTG = false;
+
// apply device transform (DPI)
// the initial translation is ignored, because we're not writing into the initial graphics device
g.transform(dpiTransform);
@@ -1177,6 +1194,7 @@ public class PageDrawer extends PDFGraph
}
finally
{
+ flipTG = oldFlipTG;
lastClip = lastClipOriginal;
graphics.dispose();
graphics = g2dOriginal;