aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/render/ps/PSRenderer.java
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-09-18 13:06:08 +0000
committerKeiron Liddle <keiron@apache.org>2001-09-18 13:06:08 +0000
commit7aee8f66f53bb505a7d2c6ee7df0eee90fe8f187 (patch)
tree289ebd9b66bd4a7ca4eba1cff74d5992d1c2b9e7 /src/org/apache/fop/render/ps/PSRenderer.java
parent7c97252576511189ce2ba7f3dbfd414051d983e1 (diff)
downloadxmlgraphics-fop-7aee8f66f53bb505a7d2c6ee7df0eee90fe8f187.tar.gz
xmlgraphics-fop-7aee8f66f53bb505a7d2c6ee7df0eee90fe8f187.zip
more refactoring of duplicate code in renderers
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194469 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render/ps/PSRenderer.java')
-rw-r--r--src/org/apache/fop/render/ps/PSRenderer.java130
1 files changed, 12 insertions, 118 deletions
diff --git a/src/org/apache/fop/render/ps/PSRenderer.java b/src/org/apache/fop/render/ps/PSRenderer.java
index e3cd72039..6785c562b 100644
--- a/src/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/org/apache/fop/render/ps/PSRenderer.java
@@ -143,7 +143,6 @@ public class PSRenderer extends AbstractRenderer {
}
}
-
/**
* write out a comment
*/
@@ -152,7 +151,6 @@ public class PSRenderer extends AbstractRenderer {
write(comment);
}
-
protected void writeFontDict(FontInfo fontInfo) {
write("%%BeginResource: procset FOPFonts");
write("%%Title: Font setup (shortcuts) for this file");
@@ -259,122 +257,17 @@ public class PSRenderer extends AbstractRenderer {
this.fontInfo = fontInfo;
}
- /**
- * render an area container to PostScript
- *
- * @param area the area container to render
- */
- public void renderAreaContainer(AreaContainer area) {
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
- if (area.getPosition() == Position.ABSOLUTE) {
- // Y position is computed assuming positive Y axis, adjust for negative postscript one
- this.currentYPosition = area.getYPosition()
- - 2 * area.getPaddingTop()
- - 2 * area.getBorderTopWidth();
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition() == Position.RELATIVE) {
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
- } else if (area.getPosition() == Position.STATIC) {
- this.currentYPosition -= area.getPaddingTop()
- + area.getBorderTopWidth();
- this.currentAreaContainerXPosition += area.getPaddingLeft()
- + area.getBorderLeftWidth();
- }
-
- this.currentXPosition = this.currentAreaContainerXPosition;
-
- // comment("% --- AreaContainer begin");
- doFrame(area);
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- // comment("% --- AreaContainer end");
-
- if (area.getPosition() != Position.STATIC) {
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- } else {
- this.currentYPosition -= area.getHeight();
- }
- }
-
- /**
- * render a body area container to PostScript
- *
- * @param area the body area container to render
- */
- public void renderBodyAreaContainer(BodyAreaContainer area) {
- int saveY = this.currentYPosition;
- int saveX = this.currentAreaContainerXPosition;
-
- if (area.getPosition() == Position.ABSOLUTE) {
- // Y position is computed assuming positive Y axis, adjust for negative postscript one
- this.currentYPosition = area.getYPosition();
- this.currentAreaContainerXPosition = area.getXPosition();
- } else if (area.getPosition() == Position.RELATIVE) {
- this.currentYPosition -= area.getYPosition();
- this.currentAreaContainerXPosition += area.getXPosition();
- }
-
- this.currentXPosition = this.currentAreaContainerXPosition;
- int w, h;
- int rx = this.currentAreaContainerXPosition;
- w = area.getContentWidth();
- h = area.getContentHeight();
- int ry = this.currentYPosition;
-
- // comment("% --- BodyAreaContainer begin");
- doFrame(area);
- // movetoCurrPosition();
-
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- // comment("% --- BodyAreaContainer end");
-
- if (area.getPosition() != Position.STATIC) {
- this.currentYPosition = saveY;
- this.currentAreaContainerXPosition = saveX;
- } else {
- this.currentYPosition -= area.getHeight();
- }
- }
-
- /**
- * render a span area to PostScript
- *
- * @param area the span area to render
- */
- public void renderSpanArea(SpanArea area) {
- // comment("% --- SpanArea begin");
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- // comment("% --- SpanArea end");
- }
-
- /**
- * render a block area to PostScript
- *
- * @param area the block area to render
- */
- public void renderBlockArea(BlockArea area) {
- // comment("% --- BlockArea begin");
- doFrame(area);
- Enumeration e = area.getChildren().elements();
- while (e.hasMoreElements()) {
- Box b = (Box)e.nextElement();
- b.render(this);
- }
- // comment("% --- BlockArea end");
+ protected void addFilledRect(int x, int y, int w, int h,
+ ColorType col) {
+ write("newpath");
+ write(x + " " + y + " M");
+ write(w + " 0 rlineto");
+ write("0 " + (-h) + " rlineto");
+ write((-w) + " 0 rlineto");
+ write("0 " + h + " rlineto");
+ write("closepath");
+ useColor(col);
+ write("fill");
}
/**
@@ -699,6 +592,7 @@ public class PSRenderer extends AbstractRenderer {
this.currentXPosition = rx;
int bl = this.currentYPosition;
+ // method is identical to super method except next line
movetoCurrPosition();
String fontWeight = area.getFontState().getFontWeight();