pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jahew...@apache.org
Subject svn commit: r1649920 - in /pdfbox/trunk/pdfbox/src: main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java
Date Tue, 06 Jan 2015 20:00:25 GMT
Author: jahewson
Date: Tue Jan  6 20:00:25 2015
New Revision: 1649920

URL: http://svn.apache.org/r1649920
Log:
PDFBOX-2590: Rename drawInlineImage to drawImage

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/image/PDInlineImageTest.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java?rev=1649920&r1=1649919&r2=1649920&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/edit/PDPageContentStream.java
Tue Jan  6 20:00:25 2015
@@ -588,20 +588,19 @@ public class PDPageContentStream impleme
     }
 
     /**
-     * Draw an xobject(form or image) at the x,y coordinates and a certain width and height.
+     * Draw an inline image at the x,y coordinates, with the default size of the image.
      *
-     * @param xobject The xobject to draw.
-     * @param x The x-coordinate to draw the image.
-     * @param y The y-coordinate to draw the image.
-     * @param width The width of the image to draw.
-     * @param height The height of the image to draw.
+     * @param inlineImage The inline image to draw.
+     * @param x The x-coordinate to draw the inline image.
+     * @param y The y-coordinate to draw the inline image.
      *
      * @throws IOException If there is an error writing to the stream.
+     * @deprecated Use {@link #drawImage(PDInlineImage, float, float)} instead.
      */
-    public void drawXObject(PDXObject xobject, float x, float y, float width, float height)
throws IOException
+    @Deprecated
+    public void drawInlineImage(PDInlineImage inlineImage, float x, float y) throws IOException
     {
-        AffineTransform transform = new AffineTransform(width, 0, 0, height, x, y);
-        drawXObject(xobject, transform);
+        drawImage(inlineImage, x, y, inlineImage.getWidth(), inlineImage.getHeight());
     }
 
     /**
@@ -613,11 +612,11 @@ public class PDPageContentStream impleme
      *
      * @throws IOException If there is an error writing to the stream.
      */
-    public void drawInlineImage(PDInlineImage inlineImage, float x, float y) throws IOException
+    public void drawImage(PDInlineImage inlineImage, float x, float y) throws IOException
     {
-        drawInlineImage(inlineImage, x, y, inlineImage.getWidth(), inlineImage.getHeight());
+        drawImage(inlineImage, x, y, inlineImage.getWidth(), inlineImage.getHeight());
     }
-    
+
     /**
      * Draw an inline image at the x,y coordinates and a certain width and height.
      *
@@ -628,12 +627,30 @@ public class PDPageContentStream impleme
      * @param height The height of the inline image to draw.
      *
      * @throws IOException If there is an error writing to the stream.
+     * @deprecated Use {@link #drawImage(PDInlineImage, float, float, float, float)} instead.
      */
+    @Deprecated
     public void drawInlineImage(PDInlineImage inlineImage, float x, float y, float width,
float height) throws IOException
     {
+        drawImage(inlineImage, x, y, width, height);
+    }
+    
+    /**
+     * Draw an inline image at the x,y coordinates and a certain width and height.
+     *
+     * @param inlineImage The inline image to draw.
+     * @param x The x-coordinate to draw the inline image.
+     * @param y The y-coordinate to draw the inline image.
+     * @param width The width of the inline image to draw.
+     * @param height The height of the inline image to draw.
+     *
+     * @throws IOException If there is an error writing to the stream.
+     */
+    public void drawImage(PDInlineImage inlineImage, float x, float y, float width, float
height) throws IOException
+    {
         if (inTextMode)
         {
-            throw new IOException("Error: drawInlineImage is not allowed within a text block.");
+            throw new IOException("Error: drawImage is not allowed within a text block.");
         }
         saveGraphicsState();
         transform(new Matrix(width, 0, 0, height, x, y));
@@ -682,6 +699,23 @@ public class PDPageContentStream impleme
     }
 
     /**
+     * Draw an xobject(form or image) at the x,y coordinates and a certain width and height.
+     *
+     * @param xobject The xobject to draw.
+     * @param x The x-coordinate to draw the image.
+     * @param y The y-coordinate to draw the image.
+     * @param width The width of the image to draw.
+     * @param height The height of the image to draw.
+     *
+     * @throws IOException If there is an error writing to the stream.
+     */
+    public void drawXObject(PDXObject xobject, float x, float y, float width, float height)
throws IOException
+    {
+        AffineTransform transform = new AffineTransform(width, 0, 0, height, x, y);
+        drawXObject(xobject, transform);
+    }
+
+    /**
      * Draw an xobject(form or image) using the given {@link AffineTransform} to position
      * the xobject.
      *

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=1649920&r1=1649919&r2=1649920&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:00:25 2015
@@ -167,11 +167,11 @@ public class PDInlineImageTest extends T
         document.addPage(page);
         PDPageContentStream contentStream = new PDPageContentStream(document, page, true,
false);
         contentStream.drawInlineImage(inlineImage1, 150, 400);
-        contentStream.drawInlineImage(inlineImage1, 150, 500, inlineImage1.getWidth() * 2,
inlineImage1.getHeight() * 2);
-        contentStream.drawInlineImage(inlineImage1, 150, 600, inlineImage1.getWidth() * 4,
inlineImage1.getHeight() * 4);
+        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.drawInlineImage(inlineImage2, 350, 500, inlineImage2.getWidth() * 2,
inlineImage2.getHeight() * 2);
-        contentStream.drawInlineImage(inlineImage2, 350, 600, inlineImage2.getWidth() * 4,
inlineImage2.getHeight() * 4);
+        contentStream.drawImage(inlineImage2, 350, 500, inlineImage2.getWidth() * 2, inlineImage2.getHeight()
* 2);
+        contentStream.drawImage(inlineImage2, 350, 600, inlineImage2.getWidth() * 4, inlineImage2.getHeight()
* 4);
         contentStream.close();
 
         File pdfFile = new File(testResultsDir, "inline.pdf");



Mime
View raw message