Search in sources :

Example 1 with SvgPathParser

use of com.github.jorgecastillo.svg.SvgPathParser in project AndroidFillableLoaders by JorgeCastilloPrz.

the class FillableLoader method buildPathData.

private void buildPathData() {
    SvgPathParser parser = getPathParser();
    pathData = new PathData();
    try {
        pathData.path = parser.parsePath(svgPath);
    } catch (ParseException e) {
        pathData.path = new Path();
    }
    PathMeasure pm = new PathMeasure(pathData.path, true);
    while (true) {
        pathData.length = Math.max(pathData.length, pm.getLength());
        if (!pm.nextContour()) {
            break;
        }
    }
}
Also used : Path(android.graphics.Path) PathMeasure(android.graphics.PathMeasure) SvgPathParser(com.github.jorgecastillo.svg.SvgPathParser) ConstrainedSvgPathParser(com.github.jorgecastillo.svg.ConstrainedSvgPathParser) ParseException(java.text.ParseException)

Aggregations

Path (android.graphics.Path)1 PathMeasure (android.graphics.PathMeasure)1 ConstrainedSvgPathParser (com.github.jorgecastillo.svg.ConstrainedSvgPathParser)1 SvgPathParser (com.github.jorgecastillo.svg.SvgPathParser)1 ParseException (java.text.ParseException)1