0

How to read svg and their path in c++? is there are any library for that like iOS pods - pocketSVG?

SVG svg = SVGParser.getSVGFromAsset(getAssets(), fileName);

In java, using svg-android library(found here) to read SVG. But to get Path from SVG file.

XPath xPath = XPathFactory.newInstance().newXPath();
        XPathExpression expr = null;
        try {
            expr = xPath.compile("//path/@d");
        } catch (XPathExpressionException e) {
            e.printStackTrace();
        }

        NodeList svgPathData = null;
        try {
            assert expr != null;
            svgPathData = (NodeList)expr.evaluate(doc, XPathConstants.NODESET);
        } catch (XPathExpressionException e) {
            e.printStackTrace();
        }
assert svgPathData != null;

        svgPaths = new Path[svgPathData.getLength()];
        for (int i = 0; i < svgPathData.getLength(); ++i){
            svgPaths[i] = SVGParser.parsePath(svgPathData.item(i).getNodeValue());
        }

It is code for get Path. Then I draw each paths on bitmap and send to Native side C++. but i need in C++ to load SVG and draw Path. Any suggestions?

Dines
  • 1
  • 3

0 Answers0