On 08.03.2005 03:18:21 Renaud Richardet wrote: <snip/> > On Mon, 28 Feb 2005 , Jeremias Maerki wrote: > > > > AbstractRenderer: I moved what I could reuse from PDFRenderer to > > > AbstractRenderer: renderTextDecorations(), handleRegionTraits(), and > > > added the > > > needed empty methods. > > > > I think that was good although only time will tell if this will hold for > > all renderers to come. > > Eventually, I didn't modify AbstractRenderer, PDFRenderer and PS > Renderer at all. > The implementation of AWTRenderer is close to the other renderers, so > that putting some methods in AbstractRenderer should not be a big > problem.
I agree. > > > Speaking of startVParea(), could we rename it to something more > > > meanigfull? > > > Proposition: TransformPosition, or something like this. > > > > Actually, I like startVParea() (or rather startViewportArea like I would > > rather call it) because only for viewport a new transformation matrix is > > necessary. > > startViewportArea() is fine for me. > > > I think the Java2D approach is not unlike the > > PDF/PS approach. > > Adobe was Sun's closest partner when they developed the Java2D API. > > > > I implemented a simple .bmp rendering (BMPReader.java). > > > If there's a better way to render .bmp (JAI?), let me know. > > > > This should not be necessary. We have a BMP implementation in > > org.apache.fop.images. > > The BMP bitmaps should be loaded through that mechanism. > > OK, now I see. But how can I get an awt.Image from a FopImage? I've modified your patch to demonstrate, but it needs some additional work to handle the different color models. Probably the image package should be extended to provide the necessary information/methods. > > BTW, Using Graphics.create() you should be able to create a copy of the > > current Graphics2D object. By pushing the old one on a stack and > > overwriting the graphics member variable should should be able to create > > the same effect as with currentState.push()/saveGraphicsState() in > > PDFRenderer.startVParea () and currentState.pop()/restoreGraphicsState > > ()in endVParea(). When leaving a VP area you can simply restore an older > > Graphics2D object for the stack and continue painting. This will undo > > any transformations and state change done in the copy used within the VP > > area. See second paragraph in javadocs of java.awt.Graphics. > > Thanks for the hint. I did just that in AWTGraphicsState (same as > PDFState). It holds all the context (font, colour, stroke, > transformation) of the current graphics, and can act as a stack, too. > I created an interface (RendererState) that could be implemented by > all xxxState of the renderers. To be discussed... I moved the interface into the awt package for now since it contains Java2D-dependant methods and classes. I don't see right now how the other renderer would fit into the picture. The PDF renderer's state class is in the pdf package and should probably stay there. > I also added a "Debug" button on the AWTRenderer-Windows, which > outlines the blocks. This is just a test, and I would like to develop > a full-fledged visual debugger [1]. That's an interesting feature. > If this code works for you, then I'll start to separate the > Java2DRenderer and the AWTRenderer. Otherwise, please tell me how I > can improve my code. I liked the patch. It's a big step forward. Keep it up! > Renaud > > [1] http://wiki.apache.org/xmlgraphics-fop/FopAndJava2D Jeremias Maerki