diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2009-07-28 13:45:56 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2009-07-28 13:45:56 +0000 |
commit | ba8c6840fba8e84780a44bf4e6da45f97f6fb283 (patch) | |
tree | 21c0d134823fc8b31a3e5b0517bac5701dc0e304 /src/java/org/apache/fop/pdf | |
parent | a699c1f06248949f7c86ff4fcbba209ab4ca8e0d (diff) | |
download | xmlgraphics-fop-ba8c6840fba8e84780a44bf4e6da45f97f6fb283.tar.gz xmlgraphics-fop-ba8c6840fba8e84780a44bf4e6da45f97f6fb283.zip |
Also use Rectangle instead of Rectangle2D for page boxes in the PDF library
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@798521 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFFactory.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFPage.java | 24 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFFactory.java b/src/java/org/apache/fop/pdf/PDFFactory.java index a8d7a0702..f3b7732f9 100644 --- a/src/java/org/apache/fop/pdf/PDFFactory.java +++ b/src/java/org/apache/fop/pdf/PDFFactory.java @@ -20,6 +20,7 @@ package org.apache.fop.pdf; // Java +import java.awt.Rectangle; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.io.FileNotFoundException; @@ -183,8 +184,8 @@ public class PDFFactory { * @return the created /Page object */ public PDFPage makePage(PDFResources resources, int pageIndex, - Rectangle2D mediaBox, Rectangle2D cropBox, - Rectangle2D bleedBox, Rectangle2D trimBox) { + Rectangle mediaBox, Rectangle cropBox, + Rectangle bleedBox, Rectangle trimBox) { PDFPage page = new PDFPage(resources, pageIndex, mediaBox, cropBox, bleedBox, trimBox); getDocument().assignObjectNumber(page); @@ -206,7 +207,7 @@ public class PDFFactory { */ public PDFPage makePage(PDFResources resources, int pageWidth, int pageHeight, int pageIndex) { - Rectangle2D mediaBox = new Rectangle2D.Double(0, 0, pageWidth, pageHeight); + Rectangle mediaBox = new Rectangle(0, 0, pageWidth, pageHeight); return makePage(resources, pageIndex, mediaBox, mediaBox, mediaBox, mediaBox); } diff --git a/src/java/org/apache/fop/pdf/PDFPage.java b/src/java/org/apache/fop/pdf/PDFPage.java index 4fa3b0a09..7a2029ffc 100644 --- a/src/java/org/apache/fop/pdf/PDFPage.java +++ b/src/java/org/apache/fop/pdf/PDFPage.java @@ -19,7 +19,7 @@ package org.apache.fop.pdf; -import java.awt.geom.Rectangle2D; +import java.awt.Rectangle; /** * Class representing a /Page object. @@ -45,8 +45,8 @@ public class PDFPage extends PDFResourceContext { * @param trimBox the TrimBox. If null, bleedBox is used. */ public PDFPage(PDFResources resources, int pageIndex, - Rectangle2D mediaBox, Rectangle2D cropBox, - Rectangle2D bleedBox, Rectangle2D trimBox) { + Rectangle mediaBox, Rectangle cropBox, + Rectangle bleedBox, Rectangle trimBox) { /* generic creation of object */ super(resources); @@ -56,8 +56,8 @@ public class PDFPage extends PDFResourceContext { this.pageIndex = pageIndex; } - private void setSimplePageSize(Rectangle2D mediaBox, Rectangle2D cropBox, - Rectangle2D bleedBox, Rectangle2D trimBox) { + private void setSimplePageSize(Rectangle mediaBox, Rectangle cropBox, + Rectangle bleedBox, Rectangle trimBox) { setMediaBox(mediaBox); if (cropBox == null) { @@ -76,16 +76,16 @@ public class PDFPage extends PDFResourceContext { setTrimBox(trimBox); //Needed for PDF/X } - private PDFArray toPDFArray(Rectangle2D box) { - return new PDFArray(this, new double[] { - box.getX(), box.getY(), box.getMaxX(), box.getMaxY()}); + private PDFArray toPDFArray(Rectangle box) { + return new PDFArray(this, new int[] { + box.x, box.y, box.x + box.width, box.y + box.height}); } /** * Sets the "MediaBox" entry * @param box the media rectangle */ - public void setMediaBox(Rectangle2D box) { + public void setMediaBox(Rectangle box) { put("MediaBox", toPDFArray(box)); } @@ -93,7 +93,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "CropBox" entry * @param box the bleed rectangle */ - public void setCropBox(Rectangle2D box) { + public void setCropBox(Rectangle box) { put("CropBox", toPDFArray(box)); } @@ -101,7 +101,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "BleedBox" entry * @param box the bleed rectangle */ - public void setBleedBox(Rectangle2D box) { + public void setBleedBox(Rectangle box) { put("BleedBox", toPDFArray(box)); } @@ -109,7 +109,7 @@ public class PDFPage extends PDFResourceContext { * Sets the "TrimBox" entry * @param box the trim rectangle */ - public void setTrimBox(Rectangle2D box) { + public void setTrimBox(Rectangle box) { put("TrimBox", toPDFArray(box)); } |