Here's my work in progress for the renderers (AWT, Print, PNG and
TIFF). Could you please give it a quick look at my patch [1], thanks.
There's a few points I would like to discuss.

I splitted the AWTRenderer from the Java2DRenderer and did some clean
up. I also created the PrintRenderer, PNGRenderer and TIFFRenderer.
Please see the class diagram at the wiki FopAndJava2D. I also
documented my work there.

I end up with a lazy rendering: Java2DRenderer only stores Viewports
and no Images. No actual rendering is done at this point. Page images
are actually rendered (with getPageImage()) when the concrete
renderers need them (that is: when the user wants to see a page (AWT)
or just before the page is encoded (PNG and TIFF) or printed. No
BufferedImage is stored. This way, the memory print should be reduced.
Is this approach OK? Could there be some thread issues?

Renderer registration:
I'm unsure if I've registered the 2 new Renderers (TIFF and PNG)
correctly in the front-end. Could you give it a look, especially
RendererFactory.createFOEventHandler(), thanks.

The PNG-Renderer outputs 1 picture per page (right?), so we end up
with several files.
My pragmatic approach is to let the user specify the first file name
on the command line (eg. "image1.png"). FOP then creates the next
images using the same directory and name pattern ("image2.png", ASO).
For this, I had to register the outfile in FOUserAgent.
We could offer more configuration possibilities, but I think it's
sufficient ATM. I don't feel like changing the front end, which looks
very clean and robust.

For PNG, TIFF and Print, the quality of the output is _very_ poor. Am
I using the right image type in
Java2DRenderer.getPageImage(PageViewport pageViewport) ?
Oleg used a TYPE_BYTE_BINARY, which seems to be the only type which
works with the TIFFEncoder from Batik. See
TIFFRenderer$LazyPageImagesIterator.next(). But the quality is poorer.
Any hints?

AWTRenderer:
I had to modify PageViewport.isResolved(), so that the flag "done" in
RenderPageModel.addPage() gets a chance to be set to true. The Map
unresolvedID is sometimes empty, but not set to null.
This way, the user can see the first page while the layout engine is
still rendering the other pages in background. Please let me know if
there's a better way to define isResolved().

PrintRenderer works somehow (with awt.PrintJob). But what I would
really like to do is passing the output of the PSRenderer to JPS
(o.a.f.render.print.JPSPrintRenderer), but that doesn't seem to work
on windowsXP. I'll check that on linux.

I put some more ant tasks on build.xml for the examples tiff and png.
the target examples-png is throwing a build.xml:1080:
java.lang.NullPointerException, and I don't understand why??

Jeremias (and anybody else), if some of my work collides with yours,
then just let me know. And please put this mail on P5 and concentrate
on the Page Breaking and XMLGraphics-commons instead ;) I won't work
on FOP until mid next week anyway.

Regards, 
Renaud

[1] http://issues.apache.org/bugzilla/show_bug.cgi?id=33760

Reply via email to