diff options
author | Glen Mazza <gmazza@apache.org> | 2003-09-21 20:56:24 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2003-09-21 20:56:24 +0000 |
commit | ce37837aaea712ad41ba4caba73e9e8c181e3e97 (patch) | |
tree | 9c9c3923b13ce853557ad56d6f553032373710ce /src | |
parent | e7bb77d5f945fa50f9600cce9e567de4dc2bf0c1 (diff) | |
download | xmlgraphics-fop-ce37837aaea712ad41ba4caba73e9e8c181e3e97.tar.gz xmlgraphics-fop-ce37837aaea712ad41ba4caba73e9e8c181e3e97.zip |
1.) Moved AWT Viewer classes from org.fop.viewer to org.fop.render.awt.viewer
2.) Updated AWT and PDF renderers to draw region borders more accurately.
3.) Rounding errors for determining region sizes in AWT Renderer fixed.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196934 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/render/awt/AWTRenderer.java | 70 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/Command.java (renamed from src/java/org/apache/fop/viewer/Command.java) | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java (renamed from src/java/org/apache/fop/viewer/GoToPageDialog.java) | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java (renamed from src/java/org/apache/fop/viewer/PreviewDialog.java) | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java (renamed from src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java) | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/Translator.java (renamed from src/java/org/apache/fop/viewer/Translator.java) | 6 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/Print.gif (renamed from src/java/org/apache/fop/viewer/images/Print.gif) | bin | 992 -> 992 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif (renamed from src/java/org/apache/fop/viewer/images/firstpg.gif) | bin | 885 -> 885 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/fop.gif (renamed from src/java/org/apache/fop/viewer/images/fop.gif) | bin | 2452 -> 2452 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif (renamed from src/java/org/apache/fop/viewer/images/lastpg.gif) | bin | 889 -> 889 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif (renamed from src/java/org/apache/fop/viewer/images/nextpg.gif) | bin | 869 -> 869 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif (renamed from src/java/org/apache/fop/viewer/images/prevpg.gif) | bin | 867 -> 867 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/images/reload.gif (renamed from src/java/org/apache/fop/viewer/images/reload.gif) | bin | 889 -> 889 bytes | |||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer.properties) | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_cs.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_de.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_fi.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_fr.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_it.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_ja.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_pl.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_ru.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties (renamed from src/java/org/apache/fop/viewer/resources/Viewer_tr.properties) | 0 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pdf/PDFRenderer.java | 43 |
24 files changed, 62 insertions, 75 deletions
diff --git a/src/java/org/apache/fop/render/awt/AWTRenderer.java b/src/java/org/apache/fop/render/awt/AWTRenderer.java index 7c3ecd116..68b52695f 100644 --- a/src/java/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/java/org/apache/fop/render/awt/AWTRenderer.java @@ -91,8 +91,8 @@ import org.apache.fop.image.FopImage; import org.apache.fop.image.ImageFactory; import org.apache.fop.render.AbstractRenderer; import org.apache.fop.traits.BorderProps; -import org.apache.fop.viewer.PreviewDialog; -import org.apache.fop.viewer.Translator; +import org.apache.fop.render.awt.viewer.PreviewDialog; +import org.apache.fop.render.awt.viewer.Translator; /** * This is FOP's AWT renderer. @@ -266,8 +266,8 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable Page page = (Page) pageList.get(pageNum); Rectangle2D bounds = pageViewport.getViewArea(); - int pageWidth = (int)((float) bounds.getWidth() / 1000f + .5); - int pageHeight = (int)((float) bounds.getHeight() / 1000f + .5); + int pageWidth = (int) Math.round(bounds.getWidth() / 1000f ); + int pageHeight = (int) Math.round(bounds.getHeight() / 1000f ); /* System.out.println("(Page) X, Y, Width, Height: " + bounds.getX() + " " + bounds.getY() @@ -315,18 +315,25 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable currentFontSize = 0; Rectangle2D viewArea = region.getViewArea(); - int startX = (int)(((float) viewArea.getX() / 1000f + .5) + int startX = (int) Math.round((viewArea.getX() / 1000f) * (scaleFactor / 100f)); - int startY = (int)(((float) viewArea.getY() / 1000f + .5) - * (scaleFactor / 100f)); - int width = (int)(((float) viewArea.getWidth() / 1000f + .5) - * (scaleFactor / 100f)); - int height = (int)(((float) viewArea.getHeight() / 1000f + .5) + int startY = (int) Math.round((viewArea.getY() / 1000f) * (scaleFactor / 100f)); + // for rounding to work correctly, need to take into account + // fractional portion of X and Y. + int width = (int) Math.round(((viewArea.getX() + viewArea.getWidth()) / 1000f) + * (scaleFactor / 100f)) - startX; + int height = (int) Math.round(((viewArea.getY() + viewArea.getHeight()) / 1000f) + * (scaleFactor / 100f)) - startY; if (region.getRegion() != null) { System.out.print("\nRegion type = " + region.getRegion().getRegionClass()); } +/* System.out.println("\nView X, Width, Y, Height: " + viewArea.getX() + + " " + viewArea.getWidth() + + " " + viewArea.getY() + + " " + viewArea.getHeight() + ); */ System.out.println(" X, Width, Y, Height: " + startX + " " + width + " " + startY @@ -382,46 +389,33 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable BorderProps bps = (BorderProps) block.getTrait(Trait.BORDER_BEFORE); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("Before (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); graphics.setColor(bps.color.getAWTColor()); - // drawLine(x1, y1, x2, y2); - System.out.println("Draw from (" + startx + "," + (starty + borderWidth/2) + - ") to (" + (startx+width) + "," + (starty + borderWidth/ 2) + ")"); - graphics.drawLine(startx, starty + borderWidth / 2, startx + width, - starty + borderWidth / 2); +// System.out.println("Border at (" + startx + "," + (starty + height - borderWidth) + +// ") width, height: (" + (width) + "," + (borderWidth) + ")"); + graphics.fillRect(startx, starty, width, borderWidth); } - bps = (BorderProps) block.getTrait(Trait.BORDER_START); + bps = (BorderProps) block.getTrait(Trait.BORDER_AFTER); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("Start (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); + int sy = starty + height; graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + (startx + borderWidth / 2) + "," + starty + - ") to (" + (startx + borderWidth / 2) + "," + (starty + height) + ")"); - graphics.drawLine(startx + borderWidth / 2, starty, startx + borderWidth / 2, - starty + height); + graphics.fillRect(startx, starty + height - borderWidth, + width, borderWidth); } - bps = (BorderProps) block.getTrait(Trait.BORDER_AFTER); + bps = (BorderProps) block.getTrait(Trait.BORDER_START); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("After (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); - int sy = starty + height; + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + startx + "," + (sy - borderWidth / 2) + - ") to (" + (startx+width) + "," + (sy - borderWidth / 2) + ")"); - graphics.drawLine(startx, sy - borderWidth / 2, startx + width, - sy - borderWidth / 2); + graphics.fillRect(startx, starty, borderWidth, height); } bps = (BorderProps) block.getTrait(Trait.BORDER_END); if (bps != null) { - int borderWidth = (int) ((bps.width / 1000f) * (scaleFactor / 100f)); - System.out.println("End (color/width) " + bps.color.getAWTColor().toString() + " " + bps.width); + int borderWidth = (int) Math.round((bps.width / 1000f) * (scaleFactor / 100f)); int sx = startx + width; graphics.setColor(bps.color.getAWTColor()); - System.out.println("Draw from (" + (sx - borderWidth / 2) + "," + starty + - ") to (" + (sx - borderWidth / 2) + "," + (starty + height) + ")"); - graphics.drawLine(sx - borderWidth / 2, starty, sx - borderWidth / 2, - starty + height); + graphics.fillRect(startx + width - borderWidth, starty, + borderWidth, height); } } } diff --git a/src/java/org/apache/fop/viewer/Command.java b/src/java/org/apache/fop/render/awt/viewer/Command.java index 616a7cfbc..efebd77c4 100644 --- a/src/java/org/apache/fop/viewer/Command.java +++ b/src/java/org/apache/fop/render/awt/viewer/Command.java @@ -1,5 +1,5 @@ /* - * $Id: Command.java,v 1.9 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.awt.event.ActionEvent; diff --git a/src/java/org/apache/fop/viewer/GoToPageDialog.java b/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java index 2156393d4..69280d289 100644 --- a/src/java/org/apache/fop/viewer/GoToPageDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java @@ -1,5 +1,5 @@ /* - * $Id: GoToPageDialog.java,v 1.6 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; import java.awt.Dimension; import java.awt.Frame; diff --git a/src/java/org/apache/fop/viewer/PreviewDialog.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java index 80387d7d4..b0986237b 100644 --- a/src/java/org/apache/fop/viewer/PreviewDialog.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java @@ -1,5 +1,5 @@ /* - * $Id: PreviewDialog.java,v 1.14 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import javax.swing.BorderFactory; diff --git a/src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java b/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java index c8423e188..4eb75ca1a 100644 --- a/src/java/org/apache/fop/viewer/PreviewDialogAboutBox.java +++ b/src/java/org/apache/fop/render/awt/viewer/PreviewDialogAboutBox.java @@ -1,5 +1,5 @@ /* - * $Id: PreviewDialogAboutBox.java,v 1.5 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.awt.AWTEvent; diff --git a/src/java/org/apache/fop/viewer/Translator.java b/src/java/org/apache/fop/render/awt/viewer/Translator.java index 2381dc1eb..251074c42 100644 --- a/src/java/org/apache/fop/viewer/Translator.java +++ b/src/java/org/apache/fop/render/awt/viewer/Translator.java @@ -1,5 +1,5 @@ /* - * $Id: Translator.java,v 1.6 2003/03/07 10:09:58 jeremias Exp $ + * $Id$ * ============================================================================ * The Apache Software License, Version 1.1 * ============================================================================ @@ -48,7 +48,7 @@ * James Tauber <jtauber@jtauber.com>. For more information on the Apache * Software Foundation, please see <http://www.apache.org/>. */ -package org.apache.fop.viewer; +package org.apache.fop.render.awt.viewer; //Java import java.util.ResourceBundle; @@ -62,7 +62,7 @@ import java.util.Locale; public class Translator { private ResourceBundle bundle; - private static String bundleBaseName = "org/apache/fop/viewer/resources/Viewer"; + private static String bundleBaseName = "org/apache/fop/render/awt/viewer/resources/Viewer"; /** * Default constructor, default <code>Locale</code> is used. diff --git a/src/java/org/apache/fop/viewer/images/Print.gif b/src/java/org/apache/fop/render/awt/viewer/images/Print.gif Binary files differindex e715fe67f..e715fe67f 100644 --- a/src/java/org/apache/fop/viewer/images/Print.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/Print.gif diff --git a/src/java/org/apache/fop/viewer/images/firstpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif Binary files differindex 1d0315d74..1d0315d74 100644 --- a/src/java/org/apache/fop/viewer/images/firstpg.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/firstpg.gif diff --git a/src/java/org/apache/fop/viewer/images/fop.gif b/src/java/org/apache/fop/render/awt/viewer/images/fop.gif Binary files differindex 63aaaae17..63aaaae17 100644 --- a/src/java/org/apache/fop/viewer/images/fop.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/fop.gif diff --git a/src/java/org/apache/fop/viewer/images/lastpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif Binary files differindex 082f13a26..082f13a26 100644 --- a/src/java/org/apache/fop/viewer/images/lastpg.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/lastpg.gif diff --git a/src/java/org/apache/fop/viewer/images/nextpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif Binary files differindex 2e3a2d7b3..2e3a2d7b3 100644 --- a/src/java/org/apache/fop/viewer/images/nextpg.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/nextpg.gif diff --git a/src/java/org/apache/fop/viewer/images/prevpg.gif b/src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif Binary files differindex 3c8cce4b6..3c8cce4b6 100644 --- a/src/java/org/apache/fop/viewer/images/prevpg.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/prevpg.gif diff --git a/src/java/org/apache/fop/viewer/images/reload.gif b/src/java/org/apache/fop/render/awt/viewer/images/reload.gif Binary files differindex 405718c1b..405718c1b 100644 --- a/src/java/org/apache/fop/viewer/images/reload.gif +++ b/src/java/org/apache/fop/render/awt/viewer/images/reload.gif diff --git a/src/java/org/apache/fop/viewer/resources/Viewer.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties index 34be39465..422dc5c58 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer.properties @@ -28,7 +28,7 @@ Title.Preview=Preview Status.Show=Show Status.Page=Page Status.of=of -Status.Build.FO.tree=Build FO tree... +Status.Build.FO.tree=Generating document... Exception.Occured=An exception has occured Exception.Error=Fatal error diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_cs.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties index d668e1292..d668e1292 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_cs.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_cs.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_de.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties index 63ebb8785..63ebb8785 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_de.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_de.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_fi.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties index 4068aad5d..4068aad5d 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_fi.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fi.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_fr.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties index 89bb37a64..89bb37a64 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_fr.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_fr.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_it.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties index fd1bd39e1..fd1bd39e1 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_it.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_it.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_ja.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties index 983a72dcb..983a72dcb 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_ja.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ja.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_pl.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties index 63bf2de9f..63bf2de9f 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_pl.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_pl.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_ru.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties index 509f22935..509f22935 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_ru.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_ru.properties diff --git a/src/java/org/apache/fop/viewer/resources/Viewer_tr.properties b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties index e87b2e10d..e87b2e10d 100644 --- a/src/java/org/apache/fop/viewer/resources/Viewer_tr.properties +++ b/src/java/org/apache/fop/render/awt/viewer/resources/Viewer_tr.properties diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java index bb3654028..ccbe28ba0 100644 --- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java @@ -590,15 +590,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx, starty + bwidth / 2, endx, starty + bwidth / 2); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + starty + " " + + width + " " + bwidth + " re\n"); + currentStream.add("f\n"); } - bps = (BorderProps)block.getTrait(Trait.BORDER_START); + bps = (BorderProps)block.getTrait(Trait.BORDER_AFTER); if (bps != null) { - float endy = starty + height; - if (!started) { started = true; closeText(); @@ -607,16 +605,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx + bwidth / 2, starty, startx + bwidth / 2, endy); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + (starty + height - bwidth) + " " + + width + " " + bwidth + " re\n"); + currentStream.add("f\n"); } - bps = (BorderProps)block.getTrait(Trait.BORDER_AFTER); + bps = (BorderProps)block.getTrait(Trait.BORDER_START); if (bps != null) { - float sy = starty + height; - float endx = startx + width; - if (!started) { started = true; closeText(); @@ -625,16 +620,13 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - - drawLine(startx, sy - bwidth / 2, endx, sy - bwidth / 2); + updateColor(bps.color, true, null); + currentStream.add(startx + " " + starty + " " + + bwidth + " " + height + " re\n"); + currentStream.add("f\n"); } bps = (BorderProps)block.getTrait(Trait.BORDER_END); if (bps != null) { - float sx = startx + width; - float endy = starty + height; - if (!started) { started = true; closeText(); @@ -643,9 +635,10 @@ public class PDFRenderer extends PrintRenderer { } float bwidth = bps.width / 1000f; - updateColor(bps.color, false, null); - currentStream.add(bwidth + " w\n"); - drawLine(sx - bwidth / 2, starty, sx - bwidth / 2, endy); + updateColor(bps.color, true, null); + currentStream.add((startx + width - bwidth) + " " + starty + " " + + bwidth + " " + height + " re\n"); + currentStream.add("f\n"); } if (started) { //restoreGraphicsState(); |