pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1484089 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java
Date Sat, 18 May 2013 10:59:14 GMT
Author: lehmi
Date: Sat May 18 10:59:14 2013
New Revision: 1484089

URL: http://svn.apache.org/r1484089
Log:
PDFBOX-1601: swap coordinates if necessary when creating a new PDRectangle

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java?rev=1484089&r1=1484088&r2=1484089&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDRectangle.java Sat
May 18 10:59:14 2013
@@ -67,7 +67,7 @@ public class PDRectangle implements COSO
     /**
      * Constructor.
      *
-     * @param box The non PD bouding box.
+     * @param box the bounding box to be used for the rectangle
      */
     public PDRectangle( BoundingBox box )
     {
@@ -85,7 +85,13 @@ public class PDRectangle implements COSO
      */
     public PDRectangle( COSArray array )
     {
-        rectArray = array;
+        float[] values = array.toFloatArray();
+        rectArray = new COSArray();
+        // we have to start with the lower left corner
+        rectArray.add( new COSFloat( Math.min(values[0],values[2] )) );
+        rectArray.add( new COSFloat( Math.min(values[1],values[3] )) );
+        rectArray.add( new COSFloat( Math.max(values[0],values[2] )) );
+        rectArray.add( new COSFloat( Math.max(values[1],values[3] )) );
     }
 
     /**



Mime
View raw message