SUMMARY:
java.lang.Object
org.apache.batik.svggen.DefaultImageHandler
org.apache.batik.svggen.ImageHandlerBase64Encoder
- All Implemented Interfaces:
- ErrorConstants, ImageHandler, SVGSyntax, CSSConstants, SVGConstants, XMLConstants
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
ImageHandlerBase64Encoder
public ImageHandlerBase64Encoder()
- Build an
ImageHandlerBase64Encoder
instance.
handleHREF
public void handleHREF(java.awt.Image image,
org.w3c.dom.Element imageElement,
SVGGeneratorContext generatorContext)
throws SVGGraphics2DIOException
- The handler should set the xlink:href tag and the width and
height attributes.
- Overrides:
handleHREF
in class DefaultImageHandler
- Throws:
SVGGraphics2DIOException
handleHREF
public void handleHREF(java.awt.image.renderable.RenderableImage image,
org.w3c.dom.Element imageElement,
SVGGeneratorContext generatorContext)
throws SVGGraphics2DIOException
- The handler should set the xlink:href tag and the width and
height attributes.
- Overrides:
handleHREF
in class DefaultImageHandler
- Throws:
SVGGraphics2DIOException
handleEmptyImage
protected void handleEmptyImage(org.w3c.dom.Element imageElement)
handleHREF
public void handleHREF(java.awt.image.RenderedImage image,
org.w3c.dom.Element imageElement,
SVGGeneratorContext generatorContext)
throws SVGGraphics2DIOException
- 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.
- Overrides:
handleHREF
in class DefaultImageHandler
- Throws:
SVGGraphics2DIOException
encodeImage
public void encodeImage(java.awt.image.RenderedImage buf,
java.io.OutputStream os)
throws SVGGraphics2DIOException
- Throws:
SVGGraphics2DIOException
buildBufferedImage
public java.awt.image.BufferedImage buildBufferedImage(java.awt.Dimension size)
- This method creates a BufferedImage with an alpha channel, as this is
supported by Base64.