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 2010/04/23 16:39:20 UTC

svn commit: r937315 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/afp: AFPBorderPainter.java AFPLineDataInfo.java

Author: jeremias
Date: Fri Apr 23 14:39:20 2010
New Revision: 937315

URL: http://svn.apache.org/viewvc?rev=937315&view=rev
Log:
Improved painting of double rules a bit, fixing a bug causing the message: "Invalid axis rule: unable to draw line"

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPBorderPainter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPLineDataInfo.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPBorderPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPBorderPainter.java?rev=937315&r1=937314&r2=937315&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPBorderPainter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPBorderPainter.java Fri Apr 23 14:39:20 2010
@@ -91,26 +91,36 @@ public class AFPBorderPainter extends Ab
         lineDataInfo.setRotation(paintingState.getRotation());
         lineDataInfo.x1 = Math.round(x1);
         lineDataInfo.y1 = Math.round(y1);
+        float thickness;
         if (borderPaintInfo.isHorizontal()) {
-            lineDataInfo.setThickness(Math.round(y2 - y1));
+            thickness = y2 - y1;
         } else {
-            lineDataInfo.setThickness(Math.round(x2 - x1));
+            thickness = x2 - x1;
         }
+        lineDataInfo.setThickness(Math.round(thickness));
 
         // handle border-*-style
         switch (borderPaintInfo.getStyle()) {
         case Constants.EN_DOUBLE:
+            int thickness3 = (int)Math.floor(thickness / 3f);
+            lineDataInfo.setThickness(thickness3);
             if (borderPaintInfo.isHorizontal()) {
                 lineDataInfo.x2 = Math.round(x2);
                 lineDataInfo.y2 = lineDataInfo.y1;
                 dataStream.createLine(lineDataInfo);
-                lineDataInfo.y1 += Math.round((lineDataInfo.thickness / 3) * 2);
+                int distance = thickness3 * 2;
+                lineDataInfo = new AFPLineDataInfo(lineDataInfo);
+                lineDataInfo.y1 += distance;
+                lineDataInfo.y2 += distance;
                 dataStream.createLine(lineDataInfo);
             } else {
                 lineDataInfo.x2 = lineDataInfo.x1;
                 lineDataInfo.y2 = Math.round(y2);
                 dataStream.createLine(lineDataInfo);
-                lineDataInfo.x1 += Math.round((lineDataInfo.thickness / 3) * 2);
+                int distance = thickness3 * 2;
+                lineDataInfo = new AFPLineDataInfo(lineDataInfo);
+                lineDataInfo.x1 += distance;
+                lineDataInfo.x2 += distance;
                 dataStream.createLine(lineDataInfo);
             }
             break;

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPLineDataInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPLineDataInfo.java?rev=937315&r1=937314&r2=937315&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPLineDataInfo.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPLineDataInfo.java Fri Apr 23 14:39:20 2010
@@ -52,6 +52,20 @@ public class AFPLineDataInfo {
     }
 
     /**
+     * Copy constructor.
+     * @param template the object to copy
+     */
+    public AFPLineDataInfo(AFPLineDataInfo template) {
+        this.x1 = template.x1;
+        this.y1 = template.y1;
+        this.x2 = template.x2;
+        this.y2 = template.y2;
+        this.thickness = template.thickness;
+        this.color = template.color;
+        this.rotation = template.rotation;
+    }
+
+    /**
      * Returns the X1 coordinate
      *
      * @return the X1 coordinate



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