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 2021/10/12 07:21:38 UTC
svn commit: r1894147 -
/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Author: tilman
Date: Tue Oct 12 07:21:38 2021
New Revision: 1894147
URL: http://svn.apache.org/viewvc?rev=1894147&view=rev
Log:
PDFBOX-5293: refactor by removing adjustRectangle(); update TODO comment
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=1894147&r1=1894146&r2=1894147&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 Tue Oct 12 07:21:38 2021
@@ -628,23 +628,9 @@ public class PageDrawer extends PDFGraph
gray = adjustImage(gray);
Rectangle2D tpgBounds = transparencyGroup.getBounds();
- adjustRectangle(tpgBounds);
return new SoftMask(parentPaint, gray, tpgBounds, backdropColor, softMask.getTransferFunction());
}
- // this adjusts the rectangle to the rotated image to put the soft mask at the correct position
- //TODO after all transparency problems have been solved:
- // 1. shouldn't this be done in transparencyGroup.getBounds() ?
- // 2. change transparencyGroup.getBounds() to getOrigin(), because size isn't used in SoftMask
- // 3. Is it possible to create the softmask and transparency group in the correct rotation?
- // (needs rendering identity testing before committing!)
- private void adjustRectangle(Rectangle2D r)
- {
- AffineTransform adjustedTransform = new AffineTransform(xform);
- adjustedTransform.scale(1.0 / xformScalingFactorX, 1.0 / xformScalingFactorY);
- r.setRect(adjustedTransform.createTransformedShape(r).getBounds2D());
- }
-
// returns the image adjusted for applySoftMaskToPaint().
private BufferedImage adjustImage(BufferedImage gray)
{
@@ -1804,9 +1790,22 @@ public class PageDrawer extends PDFGraph
public Rectangle2D getBounds()
{
// apply the underlying Graphics2D device's DPI transform and y-axis flip
- return new Rectangle2D.Double(minX - pageSize.getLowerLeftX() * xformScalingFactorX,
- (pageSize.getLowerLeftY() + pageSize.getHeight()) * xformScalingFactorY - minY - height,
- width, height);
+ Rectangle2D r =
+ new Rectangle2D.Double(
+ minX - pageSize.getLowerLeftX() * xformScalingFactorX,
+ (pageSize.getLowerLeftY() + pageSize.getHeight()) * xformScalingFactorY - minY - height,
+ width,
+ height);
+ // this adjusts the rectangle to the rotated image to put the soft mask at the correct position
+ //TODO
+ // 1. change transparencyGroup.getBounds() to getOrigin(), because size isn't used in SoftMask;
+ // also remove use of AffineTransform here
+ // 2. Is it possible to create the softmask and transparency group in the correct rotation?
+ // (needs rendering identity testing before committing!)
+ AffineTransform adjustedTransform = new AffineTransform(xform);
+ adjustedTransform.scale(1.0 / xformScalingFactorX, 1.0 / xformScalingFactorY);
+ r.setRect(adjustedTransform.createTransformedShape(r).getBounds2D());
+ return r;
}
}