aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/render
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2001-09-25 13:22:55 +0000
committerKeiron Liddle <keiron@apache.org>2001-09-25 13:22:55 +0000
commit9416d7db57fdf8fe79cc48f082568e60e3e41381 (patch)
treec4ea08f91dde5f18fc574410459306ee486c8d31 /src/org/apache/fop/render
parent894284858ff598db83eb61565cf8cbc52e2b0fa1 (diff)
downloadxmlgraphics-fop-9416d7db57fdf8fe79cc48f082568e60e3e41381.tar.gz
xmlgraphics-fop-9416d7db57fdf8fe79cc48f082568e60e3e41381.zip
fixed viewbox for svg
inline images are now correctly placed git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194485 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render')
-rw-r--r--src/org/apache/fop/render/awt/AWTRenderer.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java
index 78e812236..b623a9b64 100644
--- a/src/org/apache/fop/render/awt/AWTRenderer.java
+++ b/src/org/apache/fop/render/awt/AWTRenderer.java
@@ -487,11 +487,11 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
public void renderImageArea(ImageArea area) {
- int x = currentAreaContainerXPosition + area.getXOffset();
-
+ int x = currentXPosition + area.getXOffset();
int y = currentYPosition;
int w = area.getContentWidth();
int h = area.getHeight();
+ this.currentYPosition -= h;
FopImage img = area.getImage();
@@ -557,7 +557,7 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
}
}
- currentYPosition -= h;
+ this.currentXPosition += area.getContentWidth();
}
public void renderWordArea(WordArea area) {
@@ -699,18 +699,34 @@ public class AWTRenderer extends AbstractRenderer implements Printable, Pageable
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(userAgent);
GraphicsNode root;
+ root = builder.build(ctx, doc);
+ float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
+ float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
// correct integer roundoff aml/rlc
// graphics.translate(x / 1000f, pageHeight - y / 1000f);
graphics.translate((x + 500) / 1000, pageHeight - (y + 500) / 1000);
+ SVGSVGElement svg = ((SVGDocument)doc).getRootElement();
+ AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg, w / 1000f, h / 1000f);
+ AffineTransform inverse = null;
+ try {
+ inverse = at.createInverse();
+ } catch(NoninvertibleTransformException e) {
+ }
+ if(!at.isIdentity()) {
+ graphics.transform(at);
+ }
+
try {
- root = builder.build(ctx, doc);
root.paint(graphics);
} catch (Exception e) {
e.printStackTrace();
}
+ if(inverse != null && !inverse.isIdentity()) {
+ graphics.transform(inverse);
+ }
// correct integer roundoff aml/rlc
// graphics.translate(-x / 1000f, y / 1000f - pageHeight);
graphics.translate(-(x + 500) / 1000, (y + 500) / 1000 - pageHeight);