]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Set Batik rendering hints to improve output quality.
authorJeremias Maerki <jeremias@apache.org>
Sun, 10 Oct 2004 12:19:19 +0000 (12:19 +0000)
committerJeremias Maerki <jeremias@apache.org>
Sun, 10 Oct 2004 12:19:19 +0000 (12:19 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198025 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/render/ps/PSGraphics2D.java
src/java/org/apache/fop/svg/PDFGraphics2D.java

index 4da7cc5c32de142e8bb256eb80d23b6d7bc1cb8e..eea3c47cfd63886788c417babe076f89e03b7032 100644 (file)
@@ -53,6 +53,7 @@ import java.awt.image.renderable.RenderableImage;
 import java.io.IOException;
 
 //Batik
+import org.apache.batik.ext.awt.RenderingHintsKeyExt;
 import org.apache.batik.ext.awt.g2d.AbstractGraphics2D;
 import org.apache.batik.ext.awt.g2d.GraphicContext;
 import org.apache.commons.logging.Log;
@@ -147,6 +148,12 @@ public class PSGraphics2D extends AbstractGraphics2D {
      */
     public void setGraphicContext(GraphicContext c) {
         gc = c;
+        setPrivateHints();
+    }
+
+    private void setPrivateHints() {
+        setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, 
+                RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON);
     }
 
     /**
index e8bddd53b67c4b2c45a0e87f5dbbaae4f0ed0a02..c675fe4946394f54ba5342bdd037959b2399c374 100644 (file)
@@ -43,9 +43,9 @@ import org.apache.fop.render.pdf.FopPDFImage;
 
 import org.apache.batik.ext.awt.g2d.AbstractGraphics2D;
 import org.apache.batik.ext.awt.g2d.GraphicContext;
-//import org.apache.batik.ext.awt.MultipleGradientPaint;
 import org.apache.batik.ext.awt.RadialGradientPaint;
 import org.apache.batik.ext.awt.LinearGradientPaint;
+import org.apache.batik.ext.awt.RenderingHintsKeyExt;
 import org.apache.batik.gvt.PatternPaint;
 import org.apache.batik.gvt.GraphicsNode;
 
@@ -174,7 +174,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
      */
     public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc,
                          PDFResourceContext page, String pref, String font, float size) {
-        super(textAsShapes);
+        this(textAsShapes);
         pdfDoc = doc;
         resourceContext = page;
         currentFontName = font;
@@ -193,6 +193,26 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         super(textAsShapes);
     }
 
+    /**
+     * This constructor supports the create method.
+     * This is not implemented properly.
+     *
+     * @param g the PDF graphics to make a copy of
+     */
+    public PDFGraphics2D(PDFGraphics2D g) {
+        super(g);
+    }
+
+    /**
+     * Creates a new <code>Graphics</code> object that is
+     * a copy of this <code>Graphics</code> object.
+     * @return     a new graphics context that is a copy of
+     * this graphics context.
+     */
+    public Graphics create() {
+        return new PDFGraphics2D(this);
+    }
+
     /**
      * Set the PDF state to use when starting to draw
      * into the PDF graphics.
@@ -231,8 +251,14 @@ public class PDFGraphics2D extends AbstractGraphics2D {
      */
     public void setGraphicContext(GraphicContext c) {
         gc = c;
+        setPrivateHints();
     }
 
+    private void setPrivateHints() {
+        setRenderingHint(RenderingHintsKeyExt.KEY_AVOID_TILE_PAINTING, 
+                RenderingHintsKeyExt.VALUE_AVOID_TILE_PAINTING_ON);
+    }
+    
     /**
      * Set the override font state for drawing text.
      * This is used by the PDF text painter so that it can temporarily
@@ -245,26 +271,6 @@ public class PDFGraphics2D extends AbstractGraphics2D {
         ovFontState = infont;
     }
 
-    /**
-     * This constructor supports the create method.
-     * This is not implemented properly.
-     *
-     * @param g the PDF graphics to make a copy of
-     */
-    public PDFGraphics2D(PDFGraphics2D g) {
-        super(g);
-    }
-
-    /**
-     * Creates a new <code>Graphics</code> object that is
-     * a copy of this <code>Graphics</code> object.
-     * @return     a new graphics context that is a copy of
-     * this graphics context.
-     */
-    public Graphics create() {
-        return new PDFGraphics2D(this);
-    }
-
     /**
      * Restore the PDF graphics state to the starting state level.
      */
@@ -429,6 +435,7 @@ public class PDFGraphics2D extends AbstractGraphics2D {
      */
     public boolean drawImage(Image img, int x, int y, int width, int height,
                                ImageObserver observer) {
+        System.out.println("drawImage x=" + x + " y=" + y + " width=" + width + " height=" + height + " image=" + img.toString());
         // first we look to see if we've already added this image to
         // the pdf document. If so, we just reuse the reference;
         // otherwise we have to build a FopImage and add it to the pdf