|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.larvalabs.svgandroid.SVGParser
public class SVGParser
Entry point for parsing SVG files for Android. Use one of the various static methods for parsing SVGs by resource, asset or input stream. Optionally, a single color can be searched and replaced in the SVG while parsing. You can also parse an svg path directly.
getSVGFromResource(android.content.res.Resources, int),
getSVGFromAsset(android.content.res.AssetManager, String),
getSVGFromString(String),
getSVGFromInputStream(java.io.InputStream),
parsePath(String)| Constructor Summary | |
|---|---|
SVGParser()
|
|
| Method Summary | |
|---|---|
static SVG |
getSVGFromAsset(android.content.res.AssetManager assetMngr,
java.lang.String svgPath)
Parse SVG data from an Android application asset. |
static SVG |
getSVGFromAsset(android.content.res.AssetManager assetMngr,
java.lang.String svgPath,
int searchColor,
int replaceColor)
Parse SVG data from an Android application asset. |
static SVG |
getSVGFromInputStream(java.io.InputStream svgData)
Parse SVG data from an input stream. |
static SVG |
getSVGFromInputStream(java.io.InputStream svgData,
int searchColor,
int replaceColor)
Parse SVG data from an input stream, replacing a single color with another color. |
static SVG |
getSVGFromResource(android.content.res.Resources resources,
int resId)
Parse SVG data from an Android application resource. |
static SVG |
getSVGFromResource(android.content.res.Resources resources,
int resId,
int searchColor,
int replaceColor)
Parse SVG data from an Android application resource. |
static SVG |
getSVGFromString(java.lang.String svgData)
Parse SVG data from a string. |
static SVG |
getSVGFromString(java.lang.String svgData,
int searchColor,
int replaceColor)
Parse SVG data from a string. |
static android.graphics.Path |
parsePath(java.lang.String pathString)
Parses a single SVG path and returns it as a android.graphics.Path object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SVGParser()
| Method Detail |
|---|
public static SVG getSVGFromInputStream(java.io.InputStream svgData)
throws SVGParseException
svgData - the input stream, with SVG XML data in UTF-8 character encoding.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromString(java.lang.String svgData)
throws SVGParseException
svgData - the string containing SVG XML data.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromResource(android.content.res.Resources resources,
int resId)
throws SVGParseException
resources - the Android context resources.resId - the ID of the raw resource SVG.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromAsset(android.content.res.AssetManager assetMngr,
java.lang.String svgPath)
throws SVGParseException,
java.io.IOException
assetMngr - the Android asset manager.svgPath - the path to the SVG file in the application's assets.
SVGParseException - if there is an error while parsing.
java.io.IOException - if there was a problem reading the file.
public static SVG getSVGFromInputStream(java.io.InputStream svgData,
int searchColor,
int replaceColor)
throws SVGParseException
svgData - the input stream, with SVG XML data in UTF-8 character encoding.searchColor - the color in the SVG to replace.replaceColor - the color with which to replace the search color.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromString(java.lang.String svgData,
int searchColor,
int replaceColor)
throws SVGParseException
svgData - the string containing SVG XML data.searchColor - the color in the SVG to replace.replaceColor - the color with which to replace the search color.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromResource(android.content.res.Resources resources,
int resId,
int searchColor,
int replaceColor)
throws SVGParseException
resources - the Android contextresId - the ID of the raw resource SVG.searchColor - the color in the SVG to replace.replaceColor - the color with which to replace the search color.
SVGParseException - if there is an error while parsing.
public static SVG getSVGFromAsset(android.content.res.AssetManager assetMngr,
java.lang.String svgPath,
int searchColor,
int replaceColor)
throws SVGParseException,
java.io.IOException
assetMngr - the Android asset manager.svgPath - the path to the SVG file in the application's assets.searchColor - the color in the SVG to replace.replaceColor - the color with which to replace the search color.
SVGParseException - if there is an error while parsing.
java.io.IOException - if there was a problem reading the file.public static android.graphics.Path parsePath(java.lang.String pathString)
android.graphics.Path object.
An example path is M250,150L150,350L350,350Z, which draws a triangle.
pathString - the SVG path, see the specification here.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||