See bug 4319.

I have chosen to make this an extension rather than a replacement, although
it is quite easy to integrate the new stuff into the existing structure,
should people feel strongly about this. I would propose to do this
eventually, anyway.

Usage:
Create an instance of one of the new CachedImageHandlers, and give it to a
SVGGeneratorContext object. Then create an instance of the new
CachedImageSVGGraphics2D with this context, and off you go.

A single copy of each image will be embedded in the SVG document when using
the CachedImageHandlerBase64Encoder, while in the case of the JPEG and PNG
encoders it is even possible to use one single image file for several SVG
files: just keep reusing the same image handler.

There is one caveat for implementors of new imageHandlers: the
AbstractImageHandlerEncoder used to have an abstract method
"encodeImage(BufferedImage, File)", which had to be implemented by
subclasses. This has changed to "encodeImage(BufferedImage, OutputStream)",
because it is no longer certain that image data will actually be written to
file. I am not particularly pleased with this interface change, but could
not find a way around it. On the other hand, I think this refactorization is
actually an improvement on the old situation: the abstract class takes care
of writing to file or cache, while the actual encoder just encodes.

Paul Evenblij

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to