org.apache.batik.svggen
Class DefaultCachedImageHandler
public abstract
class
DefaultCachedImageHandler
extends Object
implements CachedImageHandler, SVGSyntax, ErrorConstants
This class is a default implementation of the GenericImageHandler
for handlers implementing a caching strategy.
See Also: SVGGraphics2D
Method Summary |
BufferedImage | buildBufferedImage(Dimension size)
This method creates a BufferedImage of the right size and type
for the derived class. |
protected void | cacheBufferedImage(Element imageElement, BufferedImage buf, SVGGeneratorContext generatorContext) |
Element | createElement(SVGGeneratorContext generatorContext)
Creates an Element which can refer to an image.
|
abstract void | encodeImage(BufferedImage buf, OutputStream os)
Derived classes should implement this method and encode the input
BufferedImage as needed |
abstract int | getBufferedImageType()
This template method should be overridden by derived classes to
declare the image type they need for saving to file. |
ImageCacher | getImageCacher()
The image cache can be used by subclasses for efficient image storage |
abstract String | getRefPrefix()
Should return the prefix with wich the image reference
should be pre-concatenated. |
protected void | handleEmptyImage(Element imageElement) |
void | handleHREF(Image image, Element imageElement, SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and
height attributes. |
protected void | handleHREF(RenderedImage image, Element imageElement, SVGGeneratorContext generatorContext)
This template method should set the xlink:href attribute on the input
Element parameter |
protected void | handleHREF(RenderableImage image, Element imageElement, SVGGeneratorContext generatorContext)
This method will delegate to the handleHREF which
uses a RenderedImage |
AffineTransform | handleImage(Image image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform |
AffineTransform | handleImage(RenderedImage image, Element imageElement, int x, int y, int width, int height, SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform |
AffineTransform | handleImage(RenderableImage image, Element imageElement, double x, double y, double width, double height, SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform |
protected AffineTransform | handleTransform(Element imageElement, double x, double y, double srcWidth, double srcHeight, double dstWidth, double dstHeight, SVGGeneratorContext generatorContext)
Determines the transformation needed to get the cached image to
scale & position properly. |
void | setDOMTreeManager(DOMTreeManager domTreeManager)
This GenericImageHandler implementation does not
need to interact with the DOMTreeManager. |
public BufferedImage buildBufferedImage(Dimension size)
This method creates a BufferedImage of the right size and type
for the derived class.
protected void cacheBufferedImage(Element imageElement, BufferedImage buf,
SVGGeneratorContext generatorContext)
Creates an Element which can refer to an image.
Note that no assumptions should be made by the caller about the
corresponding SVG tag. By default, an <image> tag is
used, but the
CachedImageHandlerBase64Encoder, for
example, overrides this method to use a different tag.
public abstract void encodeImage(BufferedImage buf, OutputStream os)
Derived classes should implement this method and encode the input
BufferedImage as needed
public abstract int getBufferedImageType()
This template method should be overridden by derived classes to
declare the image type they need for saving to file.
The image cache can be used by subclasses for efficient image storage
public abstract String getRefPrefix()
Should return the prefix with wich the image reference
should be pre-concatenated.
protected void handleEmptyImage(Element imageElement)
public void handleHREF(Image image, Element imageElement,
SVGGeneratorContext generatorContext)
The handler should set the xlink:href tag and the width and
height attributes.
protected void handleHREF(RenderedImage image, Element imageElement,
SVGGeneratorContext generatorContext)
This template method should set the xlink:href attribute on the input
Element parameter
protected void handleHREF(RenderableImage image, Element imageElement,
SVGGeneratorContext generatorContext)
This method will delegate to the handleHREF which
uses a RenderedImage
public AffineTransform handleImage(Image image, Element imageElement, int x, int y, int width, int height,
SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform
public AffineTransform handleImage(RenderedImage image, Element imageElement, int x, int y, int width, int height,
SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform
public AffineTransform handleImage(RenderableImage image, Element imageElement, double x, double y, double width, double height,
SVGGeneratorContext generatorContext)
The handler sets the xlink:href tag and returns a transform
protected AffineTransform handleTransform(Element imageElement, double x, double y, double srcWidth, double srcHeight, double dstWidth, double dstHeight,
SVGGeneratorContext generatorContext)
Determines the transformation needed to get the cached image to
scale & position properly. Sets x and y attributes on the element
accordingly.
This GenericImageHandler implementation does not
need to interact with the DOMTreeManager.
Copyright B) 2008 Apache Software Foundation. All Rights Reserved.