pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1649943 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/util/Matrix.java test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java test/java/org/apache/pdfbox/util/TestLayerUtility.java
Date Tue, 06 Jan 2015 20:39:34 GMT
Author: jahewson
Date: Tue Jan  6 20:39:34 2015
New Revision: 1649943

URL: http://svn.apache.org/r1649943
Log:
PDFBOX-2590: Avoid calling deprecated methods

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java?rev=1649943&r1=1649942&r2=1649943&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java Tue Jan  6 20:39:34
2015
@@ -224,6 +224,18 @@ public final class Matrix implements Clo
     }
 
     /**
+     * Translates this matrix by the given ammount.
+     *
+     * @param tx x-translation
+     * @param ty y-translation
+     */
+    public void translate(float tx, float ty)
+    {
+        Matrix m = Matrix.getTranslateInstance(tx, ty);
+        concatenate(m);
+    }
+
+    /**
      * Scales this matrix by the given factors.
      *
      * @param sx x-scale
@@ -235,6 +247,17 @@ public final class Matrix implements Clo
         concatenate(m);
     }
 
+    /**
+     * Rotares this matrix by the given factors.
+     *
+     * @param theta The angle of rotation measured in radians
+     */
+    public void rotate(double theta)
+    {
+        Matrix m = Matrix.getRotateInstance(theta, 0, 0);
+        concatenate(m);
+    }
+
     /**
      * This will take the current matrix and multiply it with a matrix that is passed in.
      *

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java?rev=1649943&r1=1649942&r2=1649943&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
Tue Jan  6 20:39:34 2015
@@ -166,10 +166,10 @@ public class PDInlineImageTest extends T
         PDPage page = new PDPage();
         document.addPage(page);
         PDPageContentStream contentStream = new PDPageContentStream(document, page, true,
false);
-        contentStream.drawInlineImage(inlineImage1, 150, 400);
+        contentStream.drawImage(inlineImage1, 150, 400);
         contentStream.drawImage(inlineImage1, 150, 500, inlineImage1.getWidth() * 2, inlineImage1.getHeight()
* 2);
         contentStream.drawImage(inlineImage1, 150, 600, inlineImage1.getWidth() * 4, inlineImage1.getHeight()
* 4);
-        contentStream.drawInlineImage(inlineImage2, 350, 400);
+        contentStream.drawImage(inlineImage2, 350, 400);
         contentStream.drawImage(inlineImage2, 350, 500, inlineImage2.getWidth() * 2, inlineImage2.getHeight()
* 2);
         contentStream.drawImage(inlineImage2, 350, 600, inlineImage2.getWidth() * 4, inlineImage2.getHeight()
* 4);
         contentStream.close();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java?rev=1649943&r1=1649942&r2=1649943&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java Tue Jan
 6 20:39:34 2015
@@ -197,7 +197,7 @@ public class TestLayerUtility extends Te
             PDRectangle crop = page.getCropBox();
             float cx = crop.getWidth() / 2f;
             float cy = crop.getHeight() / 2f;
-            AffineTransform transform = new AffineTransform();
+            Matrix transform = new Matrix();
             transform.translate(cx, cy);
             transform.rotate(Math.toRadians(45));
             transform.translate(-190 /* sw/2 */, 0);



Mime
View raw message