pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1780224 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
Date Wed, 25 Jan 2017 15:59:38 GMT
Author: tilman
Date: Wed Jan 25 15:59:38 2017
New Revision: 1780224

URL: http://svn.apache.org/viewvc?rev=1780224&view=rev
Log:
PDFBOX-3000: correct calculations for 180° and 270°

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=1780224&r1=1780223&r2=1780224&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 Wed Jan
25 15:59:38 2017
@@ -470,32 +470,34 @@ public class PageDrawer extends PDFGraph
     }
 
     // this adjusts the rectangle to the rotated image to put the soft mask at the correct
position
-    //TODO: 
-    // 1. check whether this works properly with cropbox
-    // after all transparency problems have been solved:
-    // 2. shouldn't this be done in transparencyGroup.getBounds() ?
-    // 3. change transparencyGroup.getBounds() to getOrigin(), because size isn't used in
SoftMask
-    // 4. Is it possible to create the softmask and transparency group in the correct rotation?
+    //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)
     {
+        Matrix m = new Matrix(xform);
         if (pageRotation == 90)
         {
-            r.setRect(pageSize.getHeight() * new Matrix(xform).getScalingFactorY() - r.getY()
- r.getHeight(), 
-                    r.getX(), 
-                    r.getWidth(), 
-                    r.getHeight());
+            r.setRect(pageSize.getHeight() * m.getScalingFactorY() - r.getY() - r.getHeight(),

+                      r.getX(), 
+                      r.getWidth(), 
+                      r.getHeight());
         }
         if (pageRotation == 180)
         {
-            r.setRect(r.getX(), 
-                    pageSize.getHeight() * new Matrix(xform).getScalingFactorY() - r.getY()
- r.getHeight(), 
-                    r.getWidth(), 
-                    r.getHeight());
+            r.setRect(pageSize.getWidth() * m.getScalingFactorX() - r.getX() - r.getWidth(),
+                      pageSize.getHeight() * m.getScalingFactorY() - r.getY() - r.getHeight(),
+                      r.getWidth(),
+                      r.getHeight());
         }
         if (pageRotation == 270)
         {
-            r.setRect(r.getY(), r.getX(), r.getWidth(), r.getHeight());
+            r.setRect(r.getY(), 
+                      pageSize.getWidth() * m.getScalingFactorX() - r.getX() - r.getWidth(),

+                      r.getWidth(), 
+                      r.getHeight());
         }
     }
 



Mime
View raw message