You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/07/28 15:02:00 UTC

svn commit: r680338 - in /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src: java/org/apache/fop/render/intermediate/ sandbox/org/apache/fop/render/svg/

Author: jeremias
Date: Mon Jul 28 06:01:58 2008
New Revision: 680338

URL: http://svn.apache.org/viewvc?rev=680338&view=rev
Log:
Reduce code duplication and make the toString() methods available to the outside (need them for debugging later).

Modified:
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
    xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java Mon Jul 28 06:01:58 2008
@@ -120,7 +120,7 @@
      * @param sb the StringBuffer to write the transform method to
      * @return the StringBuffer passed to this method
      */
-    protected StringBuffer toString(AffineTransform transform, StringBuffer sb) {
+    public static StringBuffer toString(AffineTransform transform, StringBuffer sb) {
         if (transform.isIdentity()) {
             return sb;
         }
@@ -146,6 +146,40 @@
     }
 
     /**
+     * Converts an {@code AffineTransform} array to an SVG style transform method sequence.
+     * @param transforms the transformation matrix array
+     * @param sb the StringBuffer to write the transform method sequence to
+     * @return the StringBuffer passed to this method
+     */
+    public static StringBuffer toString(AffineTransform[] transforms, StringBuffer sb) {
+        for (int i = 0, c = transforms.length; i < c; i++) {
+            if (i > 0) {
+                sb.append(' ');
+            }
+            toString(transforms[i], sb);
+        }
+        return sb;
+    }
+
+    /**
+     * Converts an {@code AffineTransform} array to an SVG style transform method sequence.
+     * @param transforms the transformation matrix array
+     * @return the formatted array
+     */
+    public static String toString(AffineTransform[] transforms) {
+        return toString(transforms, new StringBuffer()).toString();
+    }
+
+    /**
+     * Converts an {@code AffineTransform} instance to an SVG style transform method.
+     * @param transform the transformation matrix
+     * @return the formatted array
+     */
+    public static String toString(AffineTransform transform) {
+        return toString(transform, new StringBuffer()).toString();
+    }
+
+    /**
      * Convenience method to generate a startElement SAX event.
      * @param localName the local name of the element
      * @param atts the attributes

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java Mon Jul 28 06:01:58 2008
@@ -202,22 +202,13 @@
     /** {@inheritDoc} */
     public void startViewport(AffineTransform transform, Dimension size, Rectangle clipRect)
             throws IFException {
-        StringBuffer sb = new StringBuffer();
-        toString(transform, sb);
-        startViewport(sb.toString(), size, clipRect);
+        startViewport(toString(transform), size, clipRect);
     }
 
     /** {@inheritDoc} */
     public void startViewport(AffineTransform[] transforms, Dimension size, Rectangle clipRect)
             throws IFException {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0, c = transforms.length; i < c; i++) {
-            if (i > 0) {
-                sb.append(' ');
-            }
-            toString(transforms[i], sb);
-        }
-        startViewport(sb.toString(), size, clipRect);
+        startViewport(toString(transforms), size, clipRect);
     }
 
     private void startViewport(String transform, Dimension size, Rectangle clipRect) throws IFException {
@@ -248,21 +239,12 @@
 
     /** {@inheritDoc} */
     public void startGroup(AffineTransform[] transforms) throws IFException {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0, c = transforms.length; i < c; i++) {
-            if (i > 0) {
-                sb.append(' ');
-            }
-            toString(transforms[i], sb);
-        }
-        startGroup(sb.toString());
+        startGroup(toString(transforms));
     }
 
     /** {@inheritDoc} */
     public void startGroup(AffineTransform transform) throws IFException {
-        StringBuffer sb = new StringBuffer();
-        toString(transform, sb);
-        startGroup(sb.toString());
+        startGroup(toString(transform));
     }
 
     private void startGroup(String transform) throws IFException {

Modified: xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java Mon Jul 28 06:01:58 2008
@@ -85,20 +85,7 @@
     /** {@inheritDoc} */
     public void startViewport(AffineTransform transform, Dimension size, Rectangle clipRect)
             throws IFException {
-        StringBuffer sb = new StringBuffer();
-        toString(transform, sb);
-        startViewport(sb.toString(), size, clipRect);
-    }
-
-    private String toString(AffineTransform[] transforms) {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0, c = transforms.length; i < c; i++) {
-            if (i > 0) {
-                sb.append(' ');
-            }
-            toString(transforms[i], sb);
-        }
-        return sb.toString();
+        startViewport(toString(transform), size, clipRect);
     }
 
     /** {@inheritDoc} */
@@ -166,9 +153,7 @@
 
     /** {@inheritDoc} */
     public void startGroup(AffineTransform transform) throws IFException {
-        StringBuffer sb = new StringBuffer();
-        toString(transform, sb);
-        startGroup(sb.toString());
+        startGroup(toString(transform));
     }
 
     private void startGroup(String transform) throws IFException {



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org