org.apache.batik.svggen

Class ImageHandlerPNGEncoder

public class ImageHandlerPNGEncoder extends AbstractImageHandlerEncoder

This implementation of the abstract AbstractImageHandlerEncoder class creates PNG images in the image directory and sets the url pointing to that file in the xlink:href attributes of the image elements it handles.

See Also: SVGGraphics2D ImageHandlerJPEGEncoder ImageHandlerPNGEncoder

Constructor Summary
ImageHandlerPNGEncoder(String imageDir, String urlRoot)
Method Summary
BufferedImagebuildBufferedImage(Dimension size)
This method creates a BufferedImage with an alpha channel, as this is supported by PNG.
voidencodeImage(BufferedImage buf, File imageFile)
Derived classes should implement this method and encode the input BufferedImage as needed
StringgetPrefix()
StringgetSuffix()

Constructor Detail

ImageHandlerPNGEncoder

public ImageHandlerPNGEncoder(String imageDir, String urlRoot)

Parameters: imageDir directory where this handler should generate images. If null, an IllegalArgumentException is thrown. urlRoot root for the urls that point to images created by this image handler. If null, then the url corresponding to imageDir is used.

Method Detail

buildBufferedImage

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

encodeImage

public void encodeImage(BufferedImage buf, File imageFile)
Derived classes should implement this method and encode the input BufferedImage as needed

getPrefix

public final String getPrefix()

Returns: the prefix used by this encoder. E.g., "pngImage" for ImageHandlerPNGEncoder.

getSuffix

public final String getSuffix()

Returns: the suffix used by this encoder. E.g., ".png" for ImageHandlerPNGEncoder.

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.