public abstract class

SVGExternalFileResolver

extends Object
java.lang.Object
   ↳ com.caverock.androidsvg.SVGExternalFileResolver
Known Direct Subclasses

Class Overview

Resolver class used by the renderer when processing Text and Image elements.

The default behaviour is to tell AndroidSVG that the reference could not be found.

Extend this class and override the methods if you want to customise how AndroidSVG treats font and image references.

Summary

Public Constructors
SVGExternalFileResolver()
Public Methods
boolean isFormatSupported(String mimeType)
Called by renderer to determine whether a particular format is supported.
Typeface resolveFont(String fontFamily, int fontWeight, String fontStyle)
Called by renderer to resolve font references in <text> elements.
Bitmap resolveImage(String filename)
Called by renderer to resolve image file references in <image> elements.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SVGExternalFileResolver ()

Public Methods

public boolean isFormatSupported (String mimeType)

Called by renderer to determine whether a particular format is supported. In particular, this method is used in <switch> elements when processing requiredFormats conditionals.

Parameters
mimeType A MIME type (such as "image/jpeg").
Returns
  • true if your resolveImage() implementation supports this file format.

public Typeface resolveFont (String fontFamily, int fontWeight, String fontStyle)

Called by renderer to resolve font references in <text> elements.

Return a Typeface instance, or null if you want the renderer to ignore this font and use the default Android font instead.

Note that AndroidSVG does not attempt to cache Typeface references. If you want them cached, for speed or memory reasons, you should do so yourself.

Parameters
fontFamily Font family as specified in a font-family style attribute.
fontWeight Font weight as specified in a font-weight style attribute.
fontStyle Font style as specified in a font-style style attribute.
Returns
  • an Android Typeface instance, or null

public Bitmap resolveImage (String filename)

Called by renderer to resolve image file references in <image> elements.

Return a Bitmap instance, or null if you want the renderer to ignore this image.

Note that AndroidSVG does not attempt to cache Bitmap references. If you want them cached, for speed or memory reasons, you should do so yourself.

Parameters
filename the filename as provided in the xlink:href attribute of a <image> element.
Returns
  • an Android Bitmap object, or null if the image could not be found.