public class SVGParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
baseHref |
float |
height |
ExternalSupport |
mExternalSupport |
float |
width |
Constructor and Description |
---|
SVGParser() |
Modifier and Type | Method and Description |
---|---|
static void |
log(java.lang.String tag,
java.lang.String msg)
Just debug function; doing nothing.
|
SVG |
parse(java.io.InputStream svgData,
int baseWidth,
int baseHeight,
int reqWidth,
int reqHeight,
float scale,
boolean bKeepAspectRatio,
boolean bCropImage,
java.lang.String href)
Parses SVG file itself, with the parameters:
|
SVG |
parse(java.lang.String svgData,
int baseWidth,
int baseHeight,
int reqWidth,
int reqHeight,
float scale,
boolean bKeepAspectRatio,
boolean bCropImage,
java.lang.String href)
Parses SVG file itself, with the parameters:
|
void |
preparse(java.io.InputStream in,
int baseWidth,
int baseHeight)
Parses the header of SVG file to find the image sizes.
|
void |
registerAssetManager(AssetManager assetManager)
Registers external easset manager for xlink: support.
|
void |
render(java.io.InputStream in,
int x,
int y,
int baseWidth,
int baseHeight,
int reqWidth,
int reqHeight,
float scale,
boolean bKeepAspectRatio,
boolean bCropImage,
java.lang.String href,
Canvas canvas)
Parses the content, then renders the parsed context into canvas.
|
void |
render(java.lang.String svgData,
int x,
int y,
int baseWidth,
int baseHeight,
int reqWidth,
int reqHeight,
float scale,
boolean bKeepAspectRatio,
boolean bCropImage,
java.lang.String href,
Canvas canvas)
Parses the content, then renders the parsed context into canvas.
|
void |
setFont(GraphicsSVG device,
java.lang.String fontName,
java.lang.Float fontSize,
java.lang.String fontStyle,
java.lang.String fontWeight,
java.lang.String text,
boolean idleMode,
java.lang.String extUrl)
Internal method handling fonts.
|
static java.io.InputStream |
wrapIfZipped(java.io.InputStream input)
Detects if stream is GZip'ed and if yes - wraps around GZIPInputStream
|
public java.lang.String baseHref
public float height
public ExternalSupport mExternalSupport
public float width
public static void log(java.lang.String tag, java.lang.String msg)
public SVG parse(java.io.InputStream svgData, int baseWidth, int baseHeight, int reqWidth, int reqHeight, float scale, boolean bKeepAspectRatio, boolean bCropImage, java.lang.String href) throws SVGParseException
svgData
- - SVG contentbaseWidth
- - content expected width (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())baseHeight-
- content expected height (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())reqWidth
- - width to scale (might be 0 if content width should be used)reqHeight-
- height to scale (might be 0 if content width should be used)scale
- - scale factorbKeepAspectRatio
- - indicates keep aspect ratio should be used if scale appliedbCropImage
- - indicates crop should be used if scale appliedhref
- - base URL for relative paths for resourcesSVGParseException
public SVG parse(java.lang.String svgData, int baseWidth, int baseHeight, int reqWidth, int reqHeight, float scale, boolean bKeepAspectRatio, boolean bCropImage, java.lang.String href) throws SVGParseException
svgData
- - SVG contentbaseWidth
- - content expected width (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())baseHeight-
- content expected height (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())reqWidth
- - width to scale (might be 0 if content width should be used)reqHeight-
- height to scale (might be 0 if content width should be used)scale
- - scale factorbKeepAspectRatio
- - indicates keep aspect ratio should be used if scale appliedbCropImage
- - indicates crop should be used if scale appliedhref
- - base URL for relative paths for resourcesSVGParseException
public void preparse(java.io.InputStream in, int baseWidth, int baseHeight) throws SVGParseException
in
- - sourcebaseWidth
- - expected viewport (0, 0, baseWidth, baseHeight) should be used if none defied in SVG file.baseHeight-
- expected viewport (0, 0, baseWidth, baseHeight) should be used if none defied in SVG file.SVGParseException
public void registerAssetManager(AssetManager assetManager)
public void render(java.io.InputStream in, int x, int y, int baseWidth, int baseHeight, int reqWidth, int reqHeight, float scale, boolean bKeepAspectRatio, boolean bCropImage, java.lang.String href, Canvas canvas) throws SVGParseException
in
- - SVG contentbaseWidth
- - content expected width (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())baseHeight-
- content expected height (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())reqWidth
- - width to scale (might be 0 if content width should be used)reqHeight-
- height to scale (might be 0 if content width should be used)scale
- - scale factorbKeepAspectRatio
- - indicates keep aspect ratio should be used if scale appliedbCropImage
- - indicates crop should be used if scale appliedhref
- - base URL for relative paths for resourcescanvas
- - context where SVG will be rendered to.SVGParseException
public void render(java.lang.String svgData, int x, int y, int baseWidth, int baseHeight, int reqWidth, int reqHeight, float scale, boolean bKeepAspectRatio, boolean bCropImage, java.lang.String href, Canvas canvas) throws SVGParseException
svgData
- - SVG contentbaseWidth
- - content expected width (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())baseHeight-
- content expected height (might be 0 if preprocessing requested by SVGHelper::checkSVGSize())reqWidth
- - width to scale (might be 0 if content width should be used)reqHeight-
- height to scale (might be 0 if content width should be used)scale
- - scale factorbKeepAspectRatio
- - indicates keep aspect ratio should be used if scale appliedbCropImage
- - indicates crop should be used if scale appliedhref
- - base URL for relative paths for resourcescanvas
- - context where SVG will be rendered to.SVGParseException
public void setFont(GraphicsSVG device, java.lang.String fontName, java.lang.Float fontSize, java.lang.String fontStyle, java.lang.String fontWeight, java.lang.String text, boolean idleMode, java.lang.String extUrl)
public static java.io.InputStream wrapIfZipped(java.io.InputStream input)