Copyright | (c) 2011 Tillmann Vogt |
---|---|
License | BSD3 |
Maintainer | Tillmann Vogt <tillk.vogt@googlemail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Parsing the SVG path command, see http://www.w3.org/TR/SVG/paths.html#PathData :
- pathFromString :: String -> Either String [PathCommand]
- data PathCommand
Documentation
pathFromString :: String -> Either String [PathCommand]
Convert a SVG path string into a list of commands
data PathCommand
M_abs Tup | Establish a new current point (with absolute coords) |
M_rel Tup | Establish a new current point (with coords relative to the current point) |
Z | Close current subpath by drawing a straight line from current point to current subpath's initial point |
L_abs Tup | A line from the current point to Tup which becomes the new current point |
L_rel Tup | |
H_abs X | A horizontal line from the current point (cpx, cpy) to (x, cpy) |
H_rel X | |
V_abs Y | A vertical line from the current point (cpx, cpy) to (cpx, y) |
V_rel Y | |
C_abs (X1, Y1, X2, Y2, X, Y) | Draws a cubic Bézier curve from the current point to (x,y) using (x1,y1) as the ^control point at the beginning of the curve and (x2,y2) as the control point at the end of the curve. |
C_rel (X1, Y1, X2, Y2, X, Y) | |
S_abs (X2, Y2, X, Y) | Draws a cubic Bézier curve from the current point to (x,y). The first control point is assumed to be the reflection of the second control point on the previous command relative to the current point. (If there is no previous command or if the previous command was not an C, c, S or s, assume the first control point is coincident with the current point.) (x2,y2) is the second control point (i.e., the control point at the end of the curve). |
S_rel (X2, Y2, X, Y) | |
Q_abs (X1, Y1, X, Y) | A quadr. Bézier curve from the curr. point to (x,y) using (x1,y1) as the control point |
Q_rel (X1, Y1, X, Y) | Nearly the same as cubic, but with one point less |
T_abs Tup | T_Abs = Shorthand/smooth quadratic Bezier curveto |
T_rel Tup | |
A_abs | A = Elliptic arc (not used) |
A_rel |