From 82b916bf0d5dff2475e7b591e6ada7d45fa1b2b9 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Fri, 11 Nov 2005 13:44:40 +0000 Subject: Fop.java gets two new constructors: Fop(String) and Fop(String, FOUserAgent) where the String is the MIME type for the desired output format. MimeConstants provides a comprehensive list of MIME types used in Fop.java. Non-standard, FOP-specific MIME types changed to a uniform pattern: application/X-fop-awt-preview, application/X-fop-print and application/X-fop-areatree. RendererFactory now supports manual registration and dynamic discovery of Renderers and FOEventHandlers by their MIME types. Instantitation is done using MIME types everywhere. The RENDER_* constants are mapped to MIME types in Fop.java. RendererFactory is now an instantiable class whose reference is held by FOUserAgent just like it is done for the XLMHandlers. Renderers and FOEventHandlers now each have a *Maker class which is a kind of factory class which is used to register a Renderer/FOEventHandler and additionally serves to provide additional information about the thing, such as the MIME types it supports and if the implementation requires an OutputStream. The command-line gets a new option: -out application/pdf myfile.pdf is the generic way to create an output file. If someone created a WordML output handler and provided the right service resource file he could specify "-out text/xml+msword out.xml". ".out list" lists all MIME types that are available for output. Renderers can now potionally expose a Graphics2DAdapter which in concert with Graphics2DImagePainter can be used by FOP extensions to paint their content directly using a Graphics2D instance. That makes it possible to avoid a detour via SVG/Batik in certain cases. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@332549 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/Graphics2DImagePainter.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/java/org/apache/fop/render/Graphics2DImagePainter.java (limited to 'src/java/org/apache/fop/render/Graphics2DImagePainter.java') diff --git a/src/java/org/apache/fop/render/Graphics2DImagePainter.java b/src/java/org/apache/fop/render/Graphics2DImagePainter.java new file mode 100644 index 000000000..3d946b624 --- /dev/null +++ b/src/java/org/apache/fop/render/Graphics2DImagePainter.java @@ -0,0 +1,44 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.render; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.awt.geom.Rectangle2D; + +/** + * This interface is used by the Graphics2DAdapter. Components that can paint using + * a Graphics2D instance can implement this interface to paint themselves. + */ +public interface Graphics2DImagePainter { + + /** + * Called to paint the image. Implementations should scale so the image is + * painted fully inside the given area indicated by then Rectangle2D object. + * @param g2d the Graphics2D instance to paint on + * @param area the target area for the image + */ + void paint(Graphics2D g2d, Rectangle2D area); + + /** + * @return the dimensions of the image to be painted in millipoints + */ + Dimension getImageSize(); + +} \ No newline at end of file -- cgit v1.2.3