diff options
author | Jeremias Maerki <jeremias@apache.org> | 2010-04-23 14:39:20 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2010-04-23 14:39:20 +0000 |
commit | 1e649a305c5e55904afffcde5e55519d9e486f68 (patch) | |
tree | f1fbb832cbed9a1c850a9e71468abdddcbcc324f /src/java/org/apache/fop/afp | |
parent | f90e643f6ae1ef50036a18a83f81ac74ffbe116c (diff) | |
download | xmlgraphics-fop-1e649a305c5e55904afffcde5e55519d9e486f68.tar.gz xmlgraphics-fop-1e649a305c5e55904afffcde5e55519d9e486f68.zip |
Improved painting of double rules a bit, fixing a bug causing the message: "Invalid axis rule: unable to draw line"
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@937315 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/afp')
-rw-r--r-- | src/java/org/apache/fop/afp/AFPBorderPainter.java | 18 | ||||
-rw-r--r-- | src/java/org/apache/fop/afp/AFPLineDataInfo.java | 14 |
2 files changed, 28 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/afp/AFPBorderPainter.java b/src/java/org/apache/fop/afp/AFPBorderPainter.java index 4c56c0def..85046dbed 100644 --- a/src/java/org/apache/fop/afp/AFPBorderPainter.java +++ b/src/java/org/apache/fop/afp/AFPBorderPainter.java @@ -91,26 +91,36 @@ public class AFPBorderPainter extends AbstractAFPPainter { 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; diff --git a/src/java/org/apache/fop/afp/AFPLineDataInfo.java b/src/java/org/apache/fop/afp/AFPLineDataInfo.java index f3acf4f71..a056ebf1f 100644 --- a/src/java/org/apache/fop/afp/AFPLineDataInfo.java +++ b/src/java/org/apache/fop/afp/AFPLineDataInfo.java @@ -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 |