Beispiel #1
0
 /**
  * Parse SVG data from an Android application resource.
  *
  * @param resources the Android context resources.
  * @param resId the ID of the raw resource SVG.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromResource(Resources resources, int resId) throws SVGParseException {
   return SVGParser.parse(resources.openRawResource(resId), 0, 0, false);
 }
Beispiel #2
0
 /**
  * Parse SVG data from a string.
  *
  * @param svgData the string containing SVG XML data.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromString(String svgData) {
   return SVGParser.parse(new ByteArrayInputStream(svgData.getBytes()), 0, 0, false);
 }
Beispiel #3
0
 /**
  * Parse SVG data from an input stream.
  *
  * @param svgData the input stream, with SVG XML data in UTF-8 character encoding.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromInputStream(InputStream svgData) throws SVGParseException {
   return SVGParser.parse(svgData, 0, 0, false);
 }
Beispiel #4
0
 /**
  * Parse SVG data from an Android application resource.
  *
  * @param resources the Android context
  * @param resId the ID of the raw resource SVG.
  * @param searchColor the color in the SVG to replace.
  * @param replaceColor the color with which to replace the search color.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromResource(
     Resources resources, int resId, int searchColor, int replaceColor) throws SVGParseException {
   return SVGParser.parse(resources.openRawResource(resId), searchColor, replaceColor, false);
 }
Beispiel #5
0
 /**
  * Parse SVG data from a string.
  *
  * @param svgData the string containing SVG XML data.
  * @param searchColor the color in the SVG to replace.
  * @param replaceColor the color with which to replace the search color.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromString(String svgData, int searchColor, int replaceColor)
     throws SVGParseException {
   return SVGParser.parse(
       new ByteArrayInputStream(svgData.getBytes()), searchColor, replaceColor, false);
 }
Beispiel #6
0
 /**
  * Parse SVG data from an input stream, replacing a single color with another color.
  *
  * @param svgData the input stream, with SVG XML data in UTF-8 character encoding.
  * @param searchColor the color in the SVG to replace.
  * @param replaceColor the color with which to replace the search color.
  * @return the parsed SVG.
  * @throws SVGParseException if there is an error while parsing.
  */
 public static SVG getSVGFromInputStream(InputStream svgData, int searchColor, int replaceColor)
     throws SVGParseException {
   return SVGParser.parse(svgData, searchColor, replaceColor, false);
 }