diff options
author | Keiron Liddle <keiron@apache.org> | 2000-07-27 23:54:29 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2000-07-27 23:54:29 +0000 |
commit | 755df58ee2bdadc3f728f312bb8abcbbab87232a (patch) | |
tree | e7152f41c06ea319aab061663d3590cc469d5196 /src | |
parent | 273ecfddc1d46955f12e3a1a9392006a4b09ab17 (diff) | |
download | xmlgraphics-fop-755df58ee2bdadc3f728f312bb8abcbbab87232a.tar.gz xmlgraphics-fop-755df58ee2bdadc3f728f312bb8abcbbab87232a.zip |
added round edges to rects
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193564 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/fop/render/pdf/PDFRenderer.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index f2e9312b4..db58a5bd6 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -296,10 +296,22 @@ public class PDFRenderer implements Renderer { * @param fg the green component of the fill * @param fb the blue component of the fill */ - protected void addRect(float x, float y, float w, float h, DrawingInstruction di) + protected void addRect(float x, float y, float w, float h, float rx, float ry, DrawingInstruction di) { - String str = "" + x + " " + y + " " - + w + " " + h + " re\n"; + String str = ""; + if(rx == 0.0 && ry == 0.0) { + str = "" + x + " " + y + " " + w + " " + h + " re\n"; + } else { + str = "" + (x + rx) + " " + y + " m\n"; + str += "" + (x + w - rx) + " " + y + " l\n"; + str += "" + (x + w) + " " + y + " " + (x + w) + " " + y + " " + (x + w) + " " + (y + ry) + " c\n"; + str += "" + (x + w) + " " + (y + h - ry) + " l\n"; + str += "" + (x + w) + " " + (y + h) + " " + (x + w) + " " + (y + h) + " " + (x + w - rx) + " " + (y + h) + " c\n"; + str += "" + (x + rx) + " " + (y + h) + " l\n"; + str += "" + x + " " + (y + h) + " " + x + " " + (y + h) + " " + x + " " + (y + h - ry) + " c\n"; + str += "" + x + " " + (y + ry) + " l\n"; + str += "" + x + " " + y + " " + x + " " + y + " " + (x + rx) + " " + y + " c\n"; + } if(di == null) { currentStream.add(str + "S\n"); } else { @@ -1127,11 +1139,13 @@ public class PDFRenderer implements Renderer { if (area instanceof SVGRectElement) { SVGRectElement rg = (SVGRectElement)area; - float rx = rg.getX().getBaseVal().getValue(); - float ry = rg.getY().getBaseVal().getValue(); + float rectx = rg.getX().getBaseVal().getValue(); + float recty = rg.getY().getBaseVal().getValue(); + float rx = rg.getRx().getBaseVal().getValue(); + float ry = rg.getRy().getBaseVal().getValue(); float rw = rg.getWidth().getBaseVal().getValue(); float rh = rg.getHeight().getBaseVal().getValue(); - addRect(rx, ry, rw, rh, di); + addRect(rectx, recty, rw, rh, rx, ry, di); } else if (area instanceof SVGLineElement) { SVGLineElement lg = (SVGLineElement)area; float x1 = lg.getX1().getBaseVal().getValue(); |