Sebastian,

sounds interesting. I'd like to motivate you not to implement a renderer
but implement a IFDocumentHandler/IFPainter pair. This is part of the
new intermediate format I'm currently developing in a branch [1].
Renderers are quite complicated to implement. The new design OTOH allows
you to concentrate on the minimum necessary without the need to know too
many details of the area tree. I'm planning to propose a merge of this
branch into trunk before the end of the year. So I don't think there's
any risk for you to work off this branch for now. After all, I'm doing
the same by re-implementing all previous output formats (except maybe
AFP which Adrian Cumiskey is likely to handle). And it looks like
implementing an IFDocumentHandler takes less than half the development
time of a Renderer.

Like the renderers the IFDocumentHandler implementations are essentially
plug-ins to FOP, so you can easily implement this in a separate project
and if there's enough interest, we can talk about a donation to the FOP
project later.

Information about the design of the new intermediate format and the
resulting interfaces and other infrastructure can be found at [2].
You've also already got a number of examples: PDF, PCL, Java2D/TIFF are
already practically finished. PostScript is on the way and I've started
an SVG implementation in the sandbox. The best example for you is
probably the Java2D/TIFF implementation since it's closest to SWT. That
one also doesn't have to deal with all the file generating classes since
it's just working against a well-known Java API.

To start your SWT implementation, create a new Java project, decide on a
package name and prepare two classes implementing IFDocumentHandler
(document-level) and IFPainter (page-level). These interfaces are found
in the package org.apache.fop.render.intermediate. To register the new
implementation, you need to define a MIME type (see also
MimeConstants.java) and create a class extending AbstractIFDocumentHandlerMaker
which serves as a factory class. Then create a text file called
META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
in which you write the fully qualified class name of that "maker" class.
One thing I may have to add (that is currently missing) is a
setIFDocumentHandlerOverride() method in FOUserAgent, so you can set up
the output in an SWT window. The normal API is optimized for generating
files. I don't want to write too much, yet. This is already the most
important part. I'm happy to guide you further and to help you with any
questions you might have. This should already get you started.

Please consider subscribing to the fop-dev mailing list. That way I
don't have to moderate your posts each time and CC you. ;-)

[1] 
https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign
[2] http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml/NewDesign

On 13.11.2008 18:54:35 Sebastian Fuchs wrote:
> Hello,
> 
> we successfully use FOP in our eclipse rcp application to export and 
> print documents.
> To provide a print preview and to be able to use all native printer 
> driver capabilities,
> we are willing to write our own SWT renderer basing on the AreaTree.
> 
> Where can we find detailed basic information about the structure of 
> AreaTree and the approach of a render implementation ?
> 
> If there is general interest, we would contribute our work to the FOP 
> project.
> 
> Thanks,
> Sebastian

HTH
Jeremias Maerki

Reply via email to