diff options
author | Chris Bowditch <cbowditch@apache.org> | 2009-12-29 11:00:41 +0000 |
---|---|---|
committer | Chris Bowditch <cbowditch@apache.org> | 2009-12-29 11:00:41 +0000 |
commit | 83349530c26741cf8ef0e8cd511bc1fa519fa6d1 (patch) | |
tree | 25dae92b44186fcebbc6317a56f5ae08201ef19b /src | |
parent | c29802ba6fe605d59ce5de17c0ca92f569d99664 (diff) | |
download | xmlgraphics-fop-83349530c26741cf8ef0e8cd511bc1fa519fa6d1.tar.gz xmlgraphics-fop-83349530c26741cf8ef0e8cd511bc1fa519fa6d1.zip |
Bugfix: 48453 AFP Renderer: Page Segments not positioned correctly when reference-orientation != 0
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@894350 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/java/org/apache/fop/afp/DataStream.java | 18 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/afp/AFPPainter.java | 5 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/afp/AFPRenderer.java | 6 |
3 files changed, 19 insertions, 10 deletions
diff --git a/src/java/org/apache/fop/afp/DataStream.java b/src/java/org/apache/fop/afp/DataStream.java index b8da317ef..c39e0f77e 100644 --- a/src/java/org/apache/fop/afp/DataStream.java +++ b/src/java/org/apache/fop/afp/DataStream.java @@ -512,23 +512,27 @@ public class DataStream { * the x coordinate for the overlay * @param y * the y coordinate for the overlay + * @param width + * the width of the image + * @param height + * the height of the image */ - public void createIncludePageSegment(String name, int x, int y) { + public void createIncludePageSegment(String name, int x, int y, int width, int height) { int xOrigin; int yOrigin; int orientation = paintingState.getRotation(); switch (orientation) { case 90: - xOrigin = currentPage.getWidth() - y; - yOrigin = x; + xOrigin = x - height; + yOrigin = y; break; case 180: - xOrigin = currentPage.getWidth() - x; - yOrigin = currentPage.getHeight() - y; + xOrigin = x - width; + yOrigin = y - height; break; case 270: - xOrigin = y; - yOrigin = currentPage.getHeight() - x; + xOrigin = x; + yOrigin = y - height; break; default: xOrigin = x; diff --git a/src/java/org/apache/fop/render/afp/AFPPainter.java b/src/java/org/apache/fop/render/afp/AFPPainter.java index 7fcd0b3d1..22a5e0a58 100644 --- a/src/java/org/apache/fop/render/afp/AFPPainter.java +++ b/src/java/org/apache/fop/render/afp/AFPPainter.java @@ -187,7 +187,10 @@ public class AFPPainter extends AbstractIFPainter { if (name != null) { float[] srcPts = {rect.x, rect.y}; int[] coords = unitConv.mpts2units(srcPts); - getDataStream().createIncludePageSegment(name, coords[X], coords[Y]); + int width = Math.round(unitConv.mpt2units(rect.width)); + int height = Math.round(unitConv.mpt2units(rect.height)); + + getDataStream().createIncludePageSegment(name, coords[X], coords[Y], width, height); } else { drawImageUsingURI(uri, rect); } diff --git a/src/java/org/apache/fop/render/afp/AFPRenderer.java b/src/java/org/apache/fop/render/afp/AFPRenderer.java index 250ff9624..2118ac2bc 100644 --- a/src/java/org/apache/fop/render/afp/AFPRenderer.java +++ b/src/java/org/apache/fop/render/afp/AFPRenderer.java @@ -468,9 +468,11 @@ public class AFPRenderer extends AbstractPathOrientedRenderer implements AFPCust String name = (String)pageSegmentMap.get(uri); if (name != null) { - float[] srcPts = {x, y}; + float[] srcPts = {x, y, posInt.width, posInt.height}; int[] coords = unitConv.mpts2units(srcPts); - dataStream.createIncludePageSegment(name, coords[X], coords[Y]); + int width = Math.round(unitConv.mpt2units(posInt.width)); + int height = Math.round(unitConv.mpt2units(posInt.height)); + dataStream.createIncludePageSegment(name, coords[X], coords[Y], width, height); } else { ImageManager manager = userAgent.getFactory().getImageManager(); ImageInfo info = null; |