org.apache.batik.svggen

Class ImageHandlerBase64Encoder

public class ImageHandlerBase64Encoder extends DefaultImageHandler

This implementation of ImageHandler encodes the input image as a PNG image first, then encodes the PNG image using Base64 encoding and uses the result to encoder the image url using the data protocol.

See Also: SVGGraphics2D ImageHandler

Constructor Summary
ImageHandlerBase64Encoder()
Build an ImageHandlerBase64Encoder instance.
Method Summary
BufferedImagebuildBufferedImage(Dimension size)
This method creates a BufferedImage with an alpha channel, as this is supported by Base64.
voidencodeImage(RenderedImage buf, OutputStream os)
protected voidhandleEmptyImage(Element imageElement)
voidhandleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and height attributes.
voidhandleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and height attributes.
voidhandleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext)
This version of handleHREF encodes the input image into a PNG image whose bytes are then encoded with Base64.

Constructor Detail

ImageHandlerBase64Encoder

public ImageHandlerBase64Encoder()
Build an ImageHandlerBase64Encoder instance.

Method Detail

buildBufferedImage

public BufferedImage buildBufferedImage(Dimension size)
This method creates a BufferedImage with an alpha channel, as this is supported by Base64.

encodeImage

public void encodeImage(RenderedImage buf, OutputStream os)

handleEmptyImage

protected void handleEmptyImage(Element imageElement)

handleHREF

public void handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and height attributes.

handleHREF

public void handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and height attributes.

handleHREF

public void handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext)
This version of handleHREF encodes the input image into a PNG image whose bytes are then encoded with Base64. The resulting encoded data is used to set the url on the input imageElement, using the data: protocol.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.