]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
PDFNumber uses static methods
authorKeiron Liddle <keiron@apache.org>
Mon, 18 Jun 2001 08:19:25 +0000 (08:19 +0000)
committerKeiron Liddle <keiron@apache.org>
Mon, 18 Jun 2001 08:19:25 +0000 (08:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194292 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/svg/PDFDocumentGraphics2D.java
src/org/apache/fop/svg/PDFGraphics2D.java
src/org/apache/fop/svg/SVGElement.java

index 06bd070096a51e0225cff48e2f39b1fd72ad7ee8..4a2e5ea0c9aaa4eeaf5fb51a15e168bb5b9fcc09 100644 (file)
@@ -79,8 +79,7 @@ public class PDFDocumentGraphics2D extends PDFGraphics2D {
      * The result is scaled so that the svg fits correctly inside the pdf document.
      */
     public void setSVGDimension(float w, float h) {
-        PDFNumber pdfNumber = new PDFNumber();
-        currentStream.write("" + pdfNumber.doubleOut(width / w) + " 0 0 " + pdfNumber.doubleOut(height / h) + " 0 0 cm\n");
+        currentStream.write("" + PDFNumber.doubleOut(width / w) + " 0 0 " + PDFNumber.doubleOut(height / h) + " 0 0 cm\n");
     }
 
     /**
index 558d80688898bc5efb04b03cc04e4e19ffad00c3..e6eab59b8bbd5055821902e16240bc335a3bfbfa 100644 (file)
@@ -416,8 +416,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         currentColour = new PDFColor(c.getRed(), c.getGreen(), c.getBlue());
         currentStream.write(currentColour.getColorSpaceOut(false));
 
-        PDFNumber pdfNumber = new PDFNumber();
-
         applyPaint(getPaint(), false);
         applyStroke(getStroke());
 
@@ -427,26 +425,26 @@ public class PDFGraphics2D extends AbstractGraphics2D {
             int type = iter.currentSegment(vals);
             switch (type) {
                 case PathIterator.SEG_CUBICTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " " +
-                                        pdfNumber.doubleOut(vals[4]) + " " +
-                                        pdfNumber.doubleOut(vals[5]) + " c\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " " +
+                                        PDFNumber.doubleOut(vals[4]) + " " +
+                                        PDFNumber.doubleOut(vals[5]) + " c\n");
                     break;
                 case PathIterator.SEG_LINETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " l\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " l\n");
                     break;
                 case PathIterator.SEG_MOVETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " m\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " m\n");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " y\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " y\n");
                     break;
                 case PathIterator.SEG_CLOSE:
                     currentStream.write("h\n");
@@ -461,34 +459,32 @@ public class PDFGraphics2D extends AbstractGraphics2D {
     }
 
     protected void writeClip(Shape s) {
-        PDFNumber pdfNumber = new PDFNumber();
-
         PathIterator iter = s.getPathIterator(getTransform());
         while (!iter.isDone()) {
             double vals[] = new double[6];
             int type = iter.currentSegment(vals);
             switch (type) {
                 case PathIterator.SEG_CUBICTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " " +
-                                        pdfNumber.doubleOut(vals[4]) + " " +
-                                        pdfNumber.doubleOut(vals[5]) + " c\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " " +
+                                        PDFNumber.doubleOut(vals[4]) + " " +
+                                        PDFNumber.doubleOut(vals[5]) + " c\n");
                     break;
                 case PathIterator.SEG_LINETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " l\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " l\n");
                     break;
                 case PathIterator.SEG_MOVETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " m\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " m\n");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " y\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " y\n");
                     break;
                 case PathIterator.SEG_CLOSE:
                     currentStream.write("h\n");
@@ -559,7 +555,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
     protected void applyStroke(Stroke stroke) {
         if(stroke instanceof BasicStroke) {
             BasicStroke bs = (BasicStroke)stroke;
-            PDFNumber pdfNumber = new PDFNumber();
 
             float[] da = bs.getDashArray();
             if(da != null) {
@@ -600,10 +595,10 @@ public class PDFGraphics2D extends AbstractGraphics2D {
                 break;
             }
             float lw = bs.getLineWidth();
-            currentStream.write(pdfNumber.doubleOut(lw) + " w\n");
+            currentStream.write(PDFNumber.doubleOut(lw) + " w\n");
 
             float ml = bs.getMiterLimit();
-            currentStream.write(pdfNumber.doubleOut(ml) + " M\n");  
+            currentStream.write(PDFNumber.doubleOut(ml) + " M\n");  
         }
     }
 
@@ -706,12 +701,11 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         trans.translate(x, y);
         double[] vals = new double[6];
         trans.getMatrix(vals);
-        PDFNumber pdfNumber = new PDFNumber();
 
-        currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " "
-+ pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " + pdfNumber.doubleOut(vals[4])
-+ " " + pdfNumber.doubleOut(vals[5]) + " " +
-                           pdfNumber.doubleOut(vals[6]) + " Tm [" + s + "]");
+        currentStream.write(PDFNumber.doubleOut(vals[0]) + " " + PDFNumber.doubleOut(vals[1]) + " "
++ PDFNumber.doubleOut(vals[2]) + " " + PDFNumber.doubleOut(vals[3]) + " " + PDFNumber.doubleOut(vals[4])
++ " " + PDFNumber.doubleOut(vals[5]) + " " +
+                           PDFNumber.doubleOut(vals[6]) + " Tm [" + s + "]");
 
         currentStream.write("ET\n");
     }
@@ -757,15 +751,14 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         trans.translate(x, y);
         double[] vals = new double[6];
         trans.getMatrix(vals);
-        PDFNumber pdfNumber = new PDFNumber();
 
         for(char ch = iterator.first(); ch != CharacterIterator.DONE; ch = iterator.next()) {
             Map attr = iterator.getAttributes();
 
-            currentStream.write(pdfNumber.doubleOut(vals[0]) + " " + pdfNumber.doubleOut(vals[1]) + " "
-+ pdfNumber.doubleOut(vals[2]) + " " + pdfNumber.doubleOut(vals[3]) + " " + pdfNumber.doubleOut(vals[4])
-+ " " + pdfNumber.doubleOut(vals[5]) + " " +
-                           pdfNumber.doubleOut(vals[6]) + " Tm [" + ch + "]");
+            currentStream.write(PDFNumber.doubleOut(vals[0]) + " " + PDFNumber.doubleOut(vals[1]) + " "
++ PDFNumber.doubleOut(vals[2]) + " " + PDFNumber.doubleOut(vals[3]) + " " + PDFNumber.doubleOut(vals[4])
++ " " + PDFNumber.doubleOut(vals[5]) + " " +
+                           PDFNumber.doubleOut(vals[6]) + " Tm [" + ch + "]");
         }
 
         currentStream.write("ET\n");
@@ -799,34 +792,32 @@ public class PDFGraphics2D extends AbstractGraphics2D {
 
         applyPaint(getPaint(), true);
 
-        PDFNumber pdfNumber = new PDFNumber();
-
         PathIterator iter = s.getPathIterator(getTransform());
         while (!iter.isDone()) {
             double vals[] = new double[6];
             int type = iter.currentSegment(vals);
             switch (type) {
                 case PathIterator.SEG_CUBICTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " " +
-                                        pdfNumber.doubleOut(vals[4]) + " " +
-                                        pdfNumber.doubleOut(vals[5]) + " c\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " " +
+                                        PDFNumber.doubleOut(vals[4]) + " " +
+                                        PDFNumber.doubleOut(vals[5]) + " c\n");
                     break;
                 case PathIterator.SEG_LINETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " l\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " l\n");
                     break;
                 case PathIterator.SEG_MOVETO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " m\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " m\n");
                     break;
                 case PathIterator.SEG_QUADTO:
-                    currentStream.write(pdfNumber.doubleOut(vals[0]) +
-                                        " " + pdfNumber.doubleOut(vals[1]) + " " +
-                                        pdfNumber.doubleOut(vals[2]) + " " +
-                                        pdfNumber.doubleOut(vals[3]) + " y\n");
+                    currentStream.write(PDFNumber.doubleOut(vals[0]) +
+                                        " " + PDFNumber.doubleOut(vals[1]) + " " +
+                                        PDFNumber.doubleOut(vals[2]) + " " +
+                                        PDFNumber.doubleOut(vals[3]) + " y\n");
                     break;
                 case PathIterator.SEG_CLOSE:
                     currentStream.write("h\n");
index 0cb0bd45d39d102997d5378388dc5dce62f14c6e..08aa8e598d0a1f15e11a2087ba693e4f80ca63c2 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
  * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  * For details on use and redistribution please refer to the
- * LICENSE file included with these sources."
+ * LICENSE file included with these sources.
  */
 
 package org.apache.fop.svg;
@@ -83,10 +83,6 @@ public class SVGElement extends Svg {
             throw new FOPException("SVG not in fo:instream-foreign-object");
         }
 
-        /*if (this.marker == BREAK_AFTER) {
-            return new Status(Status.OK);
-        }*/
-
         if (this.marker == START) {
             this.fs = area.getFontState();