>>>>> "FI" == Felicia Ionascu <[EMAIL PROTECTED]> writes:
FI> Thomas E Deweese wrote: [deleted stuff...]
>> This is exactly what the StaticRenderer does. The transcoders
>> really shouldn't use the StaticRenderer (they should work at a
>> lower level) but I didn't write them and the StaticRenderer is such
>> a simple way to get a BufferedImage it was easier.
FI> I modified a transcoder to return directly a BufferedImage. I
FI> observed though that memory allocated somewhere in StaticRenderer
FI> (I think) is not freed. Looks like dispose() doesn't work...
Well most of it should be freed when the StaticRenderer is GC'd.
I think the 'dispose' method should clean up most references (it may
be in another method). I also remembered that the StaticRenderer
caches the results in a Tile Cache so interactive panning can be
faster. But as I said transcoders shouldn't be using StaticRenderer
the class is really intended for interactive use (hence the caching
and double buffering capabilities).
>> That all said, for large images the last thing you want is to
>> create a BufferedImage. This requires the entire image to be in
>> memory at one time. You want to work with RenderedImages which are
>> tiled and demand pull, so only the parts currently being worked on
>> are in memory.
FI> How can I avoid this? With StaticRenderer.getOffScreen(), the
FI> image I obtain is BufferedImage.
Take a look at the TiledImageTranscoder I committed. It uses
RenderedImages to avoid allocating full page buffers.
FI> And in the meantime, inside StaticRenderer allocations are done
FI> which are not garbage-collected...
>> You might try passing a Graphics2D from a grayscale image into the
>> paint method of the GVT tree. This might work, of course for
>> complex content it will fail - but I don't know how widespread the
>> failures would be.
FI> Could you please be more precise about where to look? I can't find
FI> any GVTTree class.
The GVT (Graphics Vector Toolkit) is all the classes in the
batik.gvt package. The basic class is GraphicsNode which makes up our
rendering tree (the GVT tree), essentially all the graphics elements
in an SVG file get converted to GraphicsNodes in the GVT tree.
For examples of using the GVT tree directly take a look at
batik.gvt.filter.GraphicsNodeRed8Bit in it's genRect method is
constructs a BufferedImage from a WritableRaster get's a graphics2D
from it and sets it up to call paint on it's associated GraphicsNode.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]