org.apache.batik.svggen

Class ImageHandlerJPEGEncoder

public class ImageHandlerJPEGEncoder extends AbstractImageHandlerEncoder

This implementation of the abstract AbstractImageHandlerEncoder class creates JPEG 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
ImageHandlerJPEGEncoder(String imageDir, String urlRoot)
Method Summary
BufferedImagebuildBufferedImage(Dimension size)
This method creates a BufferedImage of the right size and type for the derived class.
voidencodeImage(BufferedImage buf, File imageFile)
Derived classes should implement this method and encode the input BufferedImage as needed
StringgetPrefix()
StringgetSuffix()

Constructor Detail

ImageHandlerJPEGEncoder

public ImageHandlerJPEGEncoder(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 of the right size and type for the derived class.

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., "jpegImage" for ImageHandlerJPEGEncoder

getSuffix

public final String getSuffix()

Returns: the suffix used by this encoder. E.g., ".jpg" for ImageHandlerJPEGEncoder

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