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/java/org/apache/fop/render/intermediate/IFSerializer.java | |
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/java/org/apache/fop/render/intermediate/IFSerializer.java')
-rw-r--r-- | src/java/org/apache/fop/render/intermediate/IFSerializer.java | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/render/intermediate/IFSerializer.java b/src/java/org/apache/fop/render/intermediate/IFSerializer.java index 4eb7f0713..20db35c6a 100644 --- a/src/java/org/apache/fop/render/intermediate/IFSerializer.java +++ b/src/java/org/apache/fop/render/intermediate/IFSerializer.java @@ -22,6 +22,7 @@ package org.apache.fop.render.intermediate; 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.util.Iterator; @@ -37,6 +38,7 @@ import org.apache.xmlgraphics.util.XMLizable; import org.apache.fop.render.RenderingContext; import org.apache.fop.traits.BorderProps; +import org.apache.fop.traits.RuleStyle; import org.apache.fop.util.ColorUtil; import org.apache.fop.util.DOM2SAX; import org.apache.fop.util.XMLUtil; @@ -364,8 +366,8 @@ public class IFSerializer extends AbstractXMLWritingIFPainter implements IFConst } /** {@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 { @@ -374,15 +376,10 @@ public class IFSerializer extends AbstractXMLWritingIFPainter implements IFConst addAttribute(atts, "y", Integer.toString(rect.y)); addAttribute(atts, "width", Integer.toString(rect.width)); addAttribute(atts, "height", Integer.toString(rect.height)); - if (fill != null) { - addAttribute(atts, "fill", toString(fill)); - } - if (stroke != null) { - addAttribute(atts, "stroke", toString(stroke)); - } + addAttribute(atts, "fill", toString(fill)); element(EL_RECT, atts); } catch (SAXException e) { - throw new IFException("SAX error in drawRect()", e); + throw new IFException("SAX error in fillRect()", e); } } @@ -417,6 +414,24 @@ public class IFSerializer extends AbstractXMLWritingIFPainter implements IFConst } /** {@inheritDoc} */ + public void drawLine(Point start, Point end, int width, Color color, RuleStyle style) + throws IFException { + try { + AttributesImpl atts = new AttributesImpl(); + addAttribute(atts, "x1", Integer.toString(start.x)); + addAttribute(atts, "y1", Integer.toString(start.y)); + addAttribute(atts, "x2", Integer.toString(end.x)); + addAttribute(atts, "y2", Integer.toString(end.y)); + addAttribute(atts, "stroke-width", Integer.toString(width)); + addAttribute(atts, "color", Integer.toString(width)); + addAttribute(atts, "style", style.getName()); + element(EL_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 { AttributesImpl atts = new AttributesImpl(); |