You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ja...@apache.org on 2014/10/31 08:42:58 UTC
svn commit: r1635713 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Author: jahewson
Date: Fri Oct 31 07:42:58 2014
New Revision: 1635713
URL: http://svn.apache.org/r1635713
Log:
PDFBOX-2423: Fix raster size calculations for transparency groups
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=1635713&r1=1635712&r2=1635713&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 31 07:42:58 2014
@@ -823,29 +823,25 @@ public class PageDrawer extends PDFGraph
Graphics2D g2dOriginal = graphics;
Area lastClipOriginal = lastClip;
- // check underlying g2d
+ // the current clipping path is already the group's (transformed) bbox
+ Area clip = new Area(getGraphicsState().getCurrentClippingPath());
- Area groupClip = new Area(getGraphicsState().getCurrentClippingPath());
- Area clippingPath = new Area(form.getBBox().toGeneralPath());
- Area newArea = new Area(clippingPath);
- groupClip.intersect(newArea);
-
- AffineTransform at = g2dOriginal.getTransform();
- Shape clippingPathInPixels = at.createTransformedShape(groupClip);
- Rectangle2D bounds2D = clippingPathInPixels.getBounds2D();
-
- minX = (int) Math.floor(bounds2D.getMinX());
- minY = (int) Math.floor(bounds2D.getMinY());
- int maxX = (int) Math.floor(bounds2D.getMaxX()) + 1;
- int maxY = (int) Math.floor(bounds2D.getMaxY()) + 1;
+ // apply the underlying Graphics2D device's DPI transform
+ Shape deviceClip = xform.createTransformedShape(clip);
+ Rectangle2D bounds = deviceClip.getBounds2D();
+
+ minX = (int) Math.floor(bounds.getMinX());
+ minY = (int) Math.floor(bounds.getMinY());
+ int maxX = (int) Math.floor(bounds.getMaxX()) + 1;
+ int maxY = (int) Math.floor(bounds.getMaxY()) + 1;
width = maxX - minX;
height = maxY - minY;
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); // FIXME - color space
Graphics2D g = image.createGraphics();
g.translate(-minX, -minY);
- g.transform(at);
- g.setClip(groupClip);
+ g.transform(xform);
+ g.setClip(clip);
AffineTransform atInv;
Matrix matrix1 = null;