Author: jeremias
Date: Fri Aug 20 09:20:52 2010
New Revision: 987423
URL: http://svn.apache.org/viewvc?rev=987423&view=rev
Log:
Bugfix:
Bitmaps generated by Batik (ex. for filter effects) were not generated at the
right resolution if the SVG is scaled inside XSL-FO.
Using better resolution for the intrinsic size to avoid small scaling errors.
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java?rev=987423&r1=987422&r2=987423&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
Fri Aug 20 09:20:52 2010
@@ -71,11 +71,6 @@ public class PDFImageHandlerSVG implemen
final float uaResolution = userAgent.getSourceResolution();
SVGUserAgent ua = new SVGUserAgent(userAgent, new AffineTransform());
- //Scale for higher resolution on-the-fly images from Batik
- double s = uaResolution / deviceResolution;
- AffineTransform resolutionScaling = new AffineTransform();
- resolutionScaling.scale(s, s);
-
GVTBuilder builder = new GVTBuilder();
//Controls whether text painted by Batik is generated using text or
path operations
@@ -99,8 +94,8 @@ public class PDFImageHandlerSVG implemen
return;
}
// get the 'width' and 'height' attributes of the SVG document
- float w = (float)ctx.getDocumentSize().getWidth() * 1000f;
- float h = (float)ctx.getDocumentSize().getHeight() * 1000f;
+ float w = image.getSize().getWidthMpt();
+ float h = image.getSize().getHeightMpt();
float sx = pos.width / w;
float sy = pos.height / h;
@@ -109,6 +104,12 @@ public class PDFImageHandlerSVG implemen
AffineTransform scaling = new AffineTransform(
sx, 0, 0, sy, pos.x / 1000f, pos.y / 1000f);
+ //Scale for higher resolution on-the-fly images from Batik
+ double s = uaResolution / deviceResolution;
+ AffineTransform resolutionScaling = new AffineTransform();
+ resolutionScaling.scale(s, s);
+ resolutionScaling.scale(1.0 / sx, 1.0 / sy);
+
//Transformation matrix that establishes the local coordinate system
for the SVG graphic
//in relation to the current coordinate system
AffineTransform imageTransform = new AffineTransform();
@@ -147,7 +148,9 @@ public class PDFImageHandlerSVG implemen
+ " -> " + deviceResolution + "\n");
generator.add(
CTMHelper.toPDFString(resolutionScaling, false) + " cm\n");
- graphics.scale(1 / s, 1 / s);
+ graphics.scale(
+ 1.0 / resolutionScaling.getScaleX(),
+ 1.0 / resolutionScaling.getScaleY());
}
generator.comment("SVG start");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]