deweese 01/06/21 05:44:38 Modified: sources/org/apache/batik/svggen AbstractImageHandlerEncoder.java Log: 1) Now uses GraphicsUtil.createGraphics to get the Graphics from the BufferedImage, this ensures that the Graphics2D is properly configured for use with the GVT. This adds a dependency on GraphicsUtil, If people really complain the code can be copied out of GraphicsUtil.createGraphics (as it was before), but I would _much_ rather have the code in one place! Revision Changes Path 1.9 +12 -20 xml-batik/sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java Index: AbstractImageHandlerEncoder.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/svggen/AbstractImageHandlerEncoder.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- AbstractImageHandlerEncoder.java 2001/04/02 13:36:02 1.8 +++ AbstractImageHandlerEncoder.java 2001/06/21 12:44:37 1.9 @@ -8,16 +8,18 @@ package org.apache.batik.svggen; -import java.awt.*; -import java.awt.image.*; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.image.RenderedImage; +import java.awt.image.BufferedImage; import java.awt.image.renderable.RenderableImage; import java.awt.geom.AffineTransform; -import java.io.*; -import java.net.*; - +import java.io.File; +import java.net.MalformedURLException; +import java.awt.Dimension; import org.w3c.dom.Element; -import org.apache.batik.ext.awt.RenderingHintsKeyExt; +import org.apache.batik.ext.awt.image.GraphicsUtil; /** * This abstract implementation of the ImageHandler interface @@ -28,7 +30,7 @@ * of the file created by this handler. * * @author <a href="mailto:[EMAIL PROTECTED]">Vincent Hardy</a> - * @version $Id: AbstractImageHandlerEncoder.java,v 1.8 2001/04/02 13:36:02 cjolif Exp $ + * @version $Id: AbstractImageHandlerEncoder.java,v 1.9 2001/06/21 12:44:37 deweese Exp $ * @see org.apache.batik.svggen.SVGGraphics2D * @see org.apache.batik.svggen.ImageHandlerJPEGEncoder * @see org.apache.batik.svggen.ImageHandlerPNGEncoder @@ -89,9 +91,7 @@ image.getHeight(null)); BufferedImage buf = buildBufferedImage(size); - java.awt.Graphics2D g = buf.createGraphics(); - g.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, buf); - g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight())); + Graphics2D g = GraphicsUtil.createGraphics(buf); g.drawImage(image, 0, 0, null); g.dispose(); @@ -110,12 +110,8 @@ // Create an buffered image where the image will be drawn Dimension size = new Dimension(image.getWidth(), image.getHeight()); BufferedImage buf = buildBufferedImage(size); - - java.awt.Graphics2D g = buf.createGraphics(); - // The following help to keep the GVT renderer happy. - g.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, buf); - g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight())); + Graphics2D g = GraphicsUtil.createGraphics(buf); g.drawRenderedImage(image, IDENTITY); g.dispose(); @@ -135,12 +131,8 @@ Dimension size = new Dimension((int)Math.ceil(image.getWidth()), (int)Math.ceil(image.getHeight())); BufferedImage buf = buildBufferedImage(size); - - java.awt.Graphics2D g = buf.createGraphics(); - // The following help to keep the GVT renderer happy. - g.setRenderingHint(RenderingHintsKeyExt.KEY_BUFFERED_IMAGE, buf); - g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight())); + Graphics2D g = GraphicsUtil.createGraphics(buf); g.drawRenderableImage(image, IDENTITY); g.dispose(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]