If you look at chapter 8 of the SVG Specification, it describes how to parse a
path element. The short version is that you'll want to find the
d attribute of the element. That element should be a string describing the curve. It will contain the following commands:
m - Moveto command
l - Lineto command
a - Curve commands
z - close path
Simple lines will just be combinations of
l sequences. The curves will be either circular arcs, quadratic bezier or cubic beziers.
To convert a Bezier curve into line segments, you can do the following:
const float kNumPolyLines = 10; // <- change this to make more lines per bezier segment
const float kDeltaT = 1.0 / kNumPolyLines;
GetBezierControlPoints(&c0, &c1, &c2, &c3); // <- get the 3 or 4 control points for the next bezier segment
Point prevPoint = c0;
for (float t = kDeltaT; t <= 1.0; t += kDeltaT)
currentPoint = CalculateBezier(c0, c1, c2, c3, t);
// Now you have the next line segment in your poly line.
// It goes from prevPoint to currentPoint. Store it or draw it,
//or whatever you need
// Get ready for the next iteration
prevPoint = currentPoint;
You can find the formula for both quadratic and cubic bezier curves on Wikipedia.