diff options
author | Jeremias Maerki <jeremias@apache.org> | 2008-08-20 20:47:34 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2008-08-20 20:47:34 +0000 |
commit | 0864f618dc60cfe3dde181a06ae82b12a0f32931 (patch) | |
tree | ebaa65f4a62cc9f529f6c10c60b0be23e6251295 /src/sandbox/org/apache | |
parent | b639554f837e39f0984d0585d7effad7093a03d7 (diff) | |
download | xmlgraphics-fop-0864f618dc60cfe3dde181a06ae82b12a0f32931.tar.gz xmlgraphics-fop-0864f618dc60cfe3dde181a06ae82b12a0f32931.zip |
Added support for painting leaders (implemented as drawLine in IFPainter).
Removed unused "stroke" parameter in drawRect and renamed the method to fillRect.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@687455 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/sandbox/org/apache')
-rw-r--r-- | src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java b/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java index 80fcde0df..8f0be026e 100644 --- a/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java +++ b/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java @@ -22,6 +22,7 @@ package org.apache.fop.render.svg; import java.awt.Color; import java.awt.Dimension; import java.awt.Paint; +import java.awt.Point; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.io.FileNotFoundException; @@ -52,6 +53,7 @@ import org.apache.fop.render.intermediate.IFConstants; import org.apache.fop.render.intermediate.IFException; import org.apache.fop.render.intermediate.IFState; import org.apache.fop.traits.BorderProps; +import org.apache.fop.traits.RuleStyle; import org.apache.fop.util.ColorUtil; /** @@ -284,8 +286,8 @@ public abstract class AbstractSVGPainter extends AbstractXMLWritingIFPainter } /** {@inheritDoc} */ - public void drawRect(Rectangle rect, Paint fill, Color stroke) throws IFException { - if (fill == null && stroke == null) { + public void fillRect(Rectangle rect, Paint fill) throws IFException { + if (fill == null) { return; } try { @@ -298,12 +300,13 @@ public abstract class AbstractSVGPainter extends AbstractXMLWritingIFPainter if (fill != null) { atts.addAttribute("", "fill", "fill", CDATA, toString(fill)); } + /* disabled if (stroke != null) { - atts.addAttribute("", "stroke", "sroke", CDATA, toString(stroke)); - } + atts.addAttribute("", "stroke", "stroke", CDATA, toString(stroke)); + }*/ element("rect", atts); } catch (SAXException e) { - throw new IFException("SAX error in drawRect()", e); + throw new IFException("SAX error in fillRect()", e); } } @@ -314,6 +317,25 @@ public abstract class AbstractSVGPainter extends AbstractXMLWritingIFPainter } /** {@inheritDoc} */ + public void drawLine(Point start, Point end, int width, Color color, RuleStyle style) + throws IFException { + try { + establish(MODE_NORMAL); + AttributesImpl atts = new AttributesImpl(); + atts.addAttribute("", "x1", "x1", CDATA, Integer.toString(start.x)); + atts.addAttribute("", "y1", "y1", CDATA, Integer.toString(start.y)); + atts.addAttribute("", "x2", "x2", CDATA, Integer.toString(end.x)); + atts.addAttribute("", "y2", "y2", CDATA, Integer.toString(end.y)); + atts.addAttribute("", "stroke-width", "stroke-width", CDATA, toString(color)); + atts.addAttribute("", "fill", "fill", CDATA, toString(color)); + //TODO Handle style parameter + element("line", atts); + } catch (SAXException e) { + throw new IFException("SAX error in drawLine()", e); + } + } + + /** {@inheritDoc} */ public void drawText(int x, int y, int[] dx, int[] dy, String text) throws IFException { try { establish(MODE_TEXT); |