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 {
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);
+ }
+
}
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;
+
}
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,
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;