You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2004/10/10 14:19:19 UTC
cvs commit: xml-fop/src/java/org/apache/fop/svg PDFGraphics2D.java
jeremias 2004/10/10 05:19:19
Modified: src/java/org/apache/fop/svg PDFGraphics2D.java
Log:
Set Batik rendering hints to improve output quality.
Revision Changes Path
1.18 +29 -22 xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java
Index: PDFGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- PDFGraphics2D.java 3 Sep 2004 08:06:01 -0000 1.17
+++ PDFGraphics2D.java 10 Oct 2004 12:19:19 -0000 1.18
@@ -43,9 +43,9 @@
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 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;
@@ -194,6 +194,26 @@
}
/**
+ * 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 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
@@ -246,26 +272,6 @@
}
/**
- * 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.
*/
public void restorePDFState() {
@@ -429,6 +435,7 @@
*/
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
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org