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 2017/11/04 19:42:27 UTC

svn commit: r1814321 - in /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox: contentstream/PDAbstractContentStream.java pdmodel/PDPageContentStream.java

Author: tilman
Date: Sat Nov  4 19:42:27 2017
New Revision: 1814321

URL: http://svn.apache.org/viewvc?rev=1814321&view=rev
Log:
PDFBOX-3991: deprecate methods with double parameters, add methods with float parameters

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java?rev=1814321&r1=1814320&r2=1814321&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDAbstractContentStream.java Sat Nov  4 19:42:27 2017
@@ -286,9 +286,9 @@ public abstract class PDAbstractContentS
      * @param leading The leading in unscaled text units.
      * @throws IOException If there is an error writing to the stream.
      */
-    public void setLeading(double leading) throws IOException
+    public void setLeading(float leading) throws IOException
     {
-        writeOperand((float) leading);
+        writeOperand(leading);
         writeOperator("TL");
     }
 
@@ -693,13 +693,13 @@ public abstract class PDAbstractContentS
      * @throws IOException If an IO error occurs while writing to the stream.
      * @throws IllegalArgumentException If the parameter is invalid.
      */
-    public void setStrokingColor(double g) throws IOException
+    public void setStrokingColor(float g) throws IOException
     {
         if (isOutsideOneInterval(g))
         {
             throw new IllegalArgumentException("Parameter must be within 0..1, but is " + g);
         }
-        writeOperand((float) g);
+        writeOperand(g);
         writeOperator("G");
         setStrokingColorSpaceStack(PDDeviceGray.INSTANCE);
     }
@@ -801,7 +801,7 @@ public abstract class PDAbstractContentS
     }
 
     /**
-     * Set the non-stroking color in the DeviceRGB color space. Range is 0..1.
+     * Set the non-stroking color in the DeviceCMYK color space. Range is 0..1.
      *
      * @param c The cyan value.
      * @param m The magenta value.
@@ -809,17 +809,17 @@ public abstract class PDAbstractContentS
      * @param k The black value.
      * @throws IOException If an IO error occurs while writing to the stream.
      */
-    public void setNonStrokingColor(double c, double m, double y, double k) throws IOException
+    public void setNonStrokingColor(float c, float m, float y, float k) throws IOException
     {
         if (isOutsideOneInterval(c) || isOutsideOneInterval(m) || isOutsideOneInterval(y) || isOutsideOneInterval(k))
         {
             throw new IllegalArgumentException("Parameters must be within 0..1, but are "
                     + String.format("(%.2f,%.2f,%.2f,%.2f)", c, m, y, k));
         }
-        writeOperand((float) c);
-        writeOperand((float) m);
-        writeOperand((float) y);
-        writeOperand((float) k);
+        writeOperand(c);
+        writeOperand(m);
+        writeOperand(y);
+        writeOperand(k);
         writeOperator("k");
         setNonStrokingColorSpaceStack(PDDeviceCMYK.INSTANCE);
     }
@@ -847,13 +847,13 @@ public abstract class PDAbstractContentS
      * @throws IOException If an IO error occurs while writing to the stream.
      * @throws IllegalArgumentException If the parameter is invalid.
      */
-    public void setNonStrokingColor(double g) throws IOException
+    public void setNonStrokingColor(float g) throws IOException
     {
         if (isOutsideOneInterval(g))
         {
             throw new IllegalArgumentException("Parameter must be within 0..1, but is " + g);
         }
-        writeOperand((float) g);
+        writeOperand(g);
         writeOperator("g");
         setNonStrokingColorSpaceStack(PDDeviceGray.INSTANCE);
     }
@@ -1372,17 +1372,6 @@ public abstract class PDAbstractContentS
     }
 
     /**
-     * Writes a double number to the content stream.
-     * @param data
-     * @throws java.io.IOException
-     */
-    protected void writeOperand(double data) throws IOException
-    {
-        write(formatDecimal.format(data));
-        output.write(' ');
-    }
-
-    /**
      * Writes a real number to the content stream.
      * @param real
      * @throws java.io.IOException

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java?rev=1814321&r1=1814320&r2=1814321&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java Sat Nov  4 19:42:27 2017
@@ -1115,7 +1115,7 @@ public final class PDPageContentStream e
     @Deprecated
     public void appendRawCommands(double data) throws IOException
     {
-        writeOperand(data);
+        writeOperand((float) data);
     }
 
     /**