diff options
author | fotis <fotis@unknown> | 2000-11-25 17:05:49 +0000 |
---|---|---|
committer | fotis <fotis@unknown> | 2000-11-25 17:05:49 +0000 |
commit | fae2cca323afc3f7b10f98a59e5f3c582a717f98 (patch) | |
tree | 15c4e80a01b21b95237ca2a53d5a291d0c628b19 /src/org/apache/fop/render | |
parent | 55ab506636263d13c24ec034e1a405968e4d44ba (diff) | |
download | xmlgraphics-fop-fae2cca323afc3f7b10f98a59e5f3c582a717f98.tar.gz xmlgraphics-fop-fae2cca323afc3f7b10f98a59e5f3c582a717f98.zip |
adds support for properties leader-align, leader-pattern-width, leader-length.minimum, leader-length.maximum and leader-pattern (values: dots, space)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193837 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render')
-rw-r--r-- | src/org/apache/fop/render/Renderer.java | 5 | ||||
-rw-r--r-- | src/org/apache/fop/render/awt/AWTRenderer.java | 46 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/PDFRenderer.java | 11 | ||||
-rw-r--r-- | src/org/apache/fop/render/xml/XMLRenderer.java | 43 |
4 files changed, 61 insertions, 44 deletions
diff --git a/src/org/apache/fop/render/Renderer.java b/src/org/apache/fop/render/Renderer.java index 7be02db74..8afac542d 100644 --- a/src/org/apache/fop/render/Renderer.java +++ b/src/org/apache/fop/render/Renderer.java @@ -107,6 +107,7 @@ public interface Renderer { /** render the given page */ public void renderPage(Page page); - /** render the given rule area */ - public void renderRuleArea(RuleArea area); + /** render the given leader area */ + public void renderLeaderArea(LeaderArea area); + } diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java index 809bcff7f..ce0559d77 100644 --- a/src/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/org/apache/fop/render/awt/AWTRenderer.java @@ -613,29 +613,31 @@ public class AWTRenderer implements Renderer, Printable, Pageable { this.currentYPosition = ry - h; } - /** - * render rule area into PDF - * - * @param area area to render - */ - public void renderRuleArea(RuleArea area) { - int rx = this.currentAreaContainerXPosition + area.getStartIndent(); - int ry = this.currentYPosition; - int w = area.getContentWidth(); - int h = area.getHeight(); - int th = area.getRuleThickness(); - float r = area.getRed(); - float g = area.getGreen(); - float b = area.getBlue(); - Color oldColor = graphics.getColor(); + /** + * render leader area into AWT + * + * @param area area to render + */ + public void renderLeaderArea(LeaderArea area) { + + int rx = this.currentXPosition; + int ry = this.currentYPosition; + int w = area.getLeaderLength(); + int h = area.getHeight(); + int th = area.getRuleThickness(); + int st = area.getRuleStyle(); //not used at the moment + float r = area.getRed(); + float g = area.getGreen(); + float b = area.getBlue(); + Color oldColor = graphics.getColor(); + + graphics.setColor(new Color(r, g, b)); + graphics.fillRect((int)(rx / 1000f), (int)(pageHeight - ry / 1000f), + (int)(w / 1000f), (int)(th / 1000f)); + graphics.setColor(oldColor); + this.currentXPosition += area.getContentWidth(); + } - graphics.setColor(new Color(r, g, b)); - graphics.fillRect((int)(rx / 1000f), - (int)(pageHeight - ry / 1000f), (int)(w / 1000f), - (int)(th / 1000f)); - graphics.setColor(oldColor); - - } public void renderSVGArea(SVGArea area) { diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 0de1cfab0..c83d5f147 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -665,19 +665,20 @@ public class PDFRenderer implements Renderer { } /** - * render rule area into PDF + * render leader area into PDF * * @param area area to render */ - public void renderRuleArea(RuleArea area) { - int rx = this.currentAreaContainerXPosition - + area.getStartIndent(); + public void renderLeaderArea(LeaderArea area) { + int rx = this.currentXPosition;; int ry = this.currentYPosition; int w = area.getContentWidth(); int h = area.getHeight(); int th = area.getRuleThickness(); - + int st = area.getRuleStyle(); //not used at the moment + addLine(rx, ry, rx+w, ry, th, new PDFColor(area.getRed(), area.getGreen(),area.getBlue())); + this.currentXPosition += area.getContentWidth(); } /** diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index aff72e19a..85b83f459 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -59,6 +59,7 @@ import org.apache.fop.render.Renderer; import org.apache.fop.image.ImageArea; import org.apache.fop.layout.*; import org.apache.fop.pdf.*; +import org.apache.fop.fo.properties.LeaderPattern; // Java import java.io.IOException; @@ -317,20 +318,32 @@ public class XMLRenderer implements Renderer { } /** - * render a rule area to XML - * - * @param area the area to render - */ - public void renderRuleArea(RuleArea area) { - writeEmptyElementTag("<Rule start-indent=\"" - + area.getStartIndent() - + "\" end-indent=\"" - + area.getEndIndent() - + "\" rule-thickness=\"" - + area.getRuleThickness() - + "\" red=\"" + area.getRed() - + "\" green=\"" + area.getGreen() - + "\" blue = \"" + area.getBlue() - + "\"/>"); + * render a leader area to XML + * + * @param area the area to render + */ + public void renderLeaderArea(LeaderArea area) { + String leaderPattern = ""; + switch (area.getLeaderPattern()) { + case LeaderPattern.SPACE: + leaderPattern = "space"; + break; + case LeaderPattern.RULE: + leaderPattern = "rule"; + break; + case LeaderPattern.DOTS: + leaderPattern = "dots"; + break; + case LeaderPattern.USECONTENT: + leaderPattern = "use-content"; + break; + } + + writeEmptyElementTag("<Leader leader-pattern=\"" + leaderPattern + + " leader-length=\"" + area.getLeaderLength()+ + "\" rule-thickness=\"" + area.getRuleThickness() + + "\" rule-style=\"" + area.getRuleStyle() + + "\" red=\"" + area.getRed() + "\" green=\"" + area.getGreen() + + "\" blue = \"" + area.getBlue() + "\"/>"); } } |