From 04162ace0a4442232aa993a77a7c08ba445a386c Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 14 May 2008 14:16:49 +0000 Subject: [PATCH] Restored plug-in API compatibility with FOP 0.94. Fixes a NoSuchMethodError when Barcode4J is run. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_95@656286 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/render/AbstractGraphics2DAdapter.java | 11 ++++++++++- .../apache/fop/render/Graphics2DAdapter.java | 19 +++++++++++++++++++ .../java2d/Java2DGraphics2DAdapter.java | 4 ++-- .../fop/render/ps/PSGraphics2DAdapter.java | 4 ++-- 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java index bc7bb95a1..e91947ba5 100644 --- a/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/AbstractGraphics2DAdapter.java @@ -32,12 +32,13 @@ import java.awt.image.ComponentColorModel; import java.awt.image.DataBuffer; import java.awt.image.Raster; import java.awt.image.WritableRaster; +import java.io.IOException; import org.apache.fop.render.RendererContext.RendererContextWrapper; import org.apache.fop.util.UnitConv; /** - * Graphics2DAdapter implementation for PCL and HP GL/2. + * Abstract base class for Graphics2DAdapter implementations. */ public abstract class AbstractGraphics2DAdapter implements Graphics2DAdapter { @@ -135,4 +136,12 @@ public abstract class AbstractGraphics2DAdapter implements Graphics2DAdapter { RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); } + /** {@inheritDoc} */ + public void paintImage(Graphics2DImagePainter painter, + RendererContext context, + int x, int y, int width, int height) throws IOException { + paintImage((org.apache.xmlgraphics.java2d.Graphics2DImagePainter)painter, + context, x, y, width, height); + } + } diff --git a/src/java/org/apache/fop/render/Graphics2DAdapter.java b/src/java/org/apache/fop/render/Graphics2DAdapter.java index 0123e04a1..4fbdbe09a 100644 --- a/src/java/org/apache/fop/render/Graphics2DAdapter.java +++ b/src/java/org/apache/fop/render/Graphics2DAdapter.java @@ -47,4 +47,23 @@ public interface Graphics2DAdapter { RendererContext context, int x, int y, int width, int height) throws IOException; + /** + * Paints an arbitrary images on a given Graphics2D instance. The renderer + * providing this functionality must set up a Graphics2D instance so that + * the image with the given extents (in mpt) can be painted by the painter + * passed to this method. The Graphics2DImagePainter is then passed this + * Graphics2D instance so the image can be painted. + * @param painter the painter which will paint the actual image + * @param context the renderer context for the current renderer + * @param x X position of the image + * @param y Y position of the image + * @param width width of the image + * @param height height of the image + * @throws IOException In case of an I/O error while writing the output format + * @deprecated Use the variant with the Graphics2DImagePainter from XML Graphics Commons instead + */ + void paintImage(Graphics2DImagePainter painter, + RendererContext context, + int x, int y, int width, int height) throws IOException; + } diff --git a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java b/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java index 48feba135..b29378a96 100644 --- a/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java @@ -28,13 +28,13 @@ import java.io.IOException; import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; -import org.apache.fop.render.Graphics2DAdapter; +import org.apache.fop.render.AbstractGraphics2DAdapter; import org.apache.fop.render.RendererContext; /** * Graphics2DAdapter implementation for Java2D. */ -public class Java2DGraphics2DAdapter implements Graphics2DAdapter { +public class Java2DGraphics2DAdapter extends AbstractGraphics2DAdapter { /** {@inheritDoc} */ public void paintImage(Graphics2DImagePainter painter, diff --git a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java index a592b4f44..994481d59 100644 --- a/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java +++ b/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java @@ -28,13 +28,13 @@ import org.apache.xmlgraphics.java2d.Graphics2DImagePainter; import org.apache.xmlgraphics.java2d.ps.PSGraphics2D; import org.apache.xmlgraphics.ps.PSGenerator; -import org.apache.fop.render.Graphics2DAdapter; +import org.apache.fop.render.AbstractGraphics2DAdapter; import org.apache.fop.render.RendererContext; /** * Graphics2DAdapter implementation for PostScript. */ -public class PSGraphics2DAdapter implements Graphics2DAdapter { +public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter { private PSGenerator gen; private boolean clip = true; -- 2.39.5