Copyright | (c) 2011 Tillmann Vogt |
---|---|

License | BSD3 |

Maintainer | Tillmann Vogt <tillk.vogt@googlemail.com> |

Stability | stable |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell2010 |

Parsing the SVG path command, see http://www.w3.org/TR/SVG/paths.html#PathData :

- pathFromString :: Fractional n => String -> Either String [PathCommand n]
- pathFromByteString :: Fractional n => ByteString -> Either String [PathCommand n]
- data PathCommand n

# Documentation

pathFromString :: Fractional n => String -> Either String [PathCommand n] #

Convert a SVG path string into a list of commands

pathFromByteString :: Fractional n => ByteString -> Either String [PathCommand n] #

data PathCommand n #

M_abs !(n, n) | Establish a new current point (with absolute coords) |

M_rel !(n, n) | 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 !(n, n) | A line from the current point to (n, n) which becomes the new current point |

L_rel !(n, n) | |

H_abs !n | A horizontal line from the current point (cpx, cpy) to (x, cpy) |

H_rel !n | |

V_abs !n | A vertical line from the current point (cpx, cpy) to (cpx, y) |

V_rel !n | |

C_abs !(n, n, n, n, n, n) | 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 !(n, n, n, n, n, n) | |

S_abs !(n, n, n, n) | 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 !(n, n, n, n) | |

Q_abs !(n, n, n, n) | A quadr. Bézier curve from the curr. point to (x,y) using (x1,y1) as the control point |

Q_rel !(n, n, n, n) | Nearly the same as cubic, but with one point less |

T_abs !(n, n) | T_Abs = Shorthand/smooth quadratic Bezier curveto |

T_rel !(n, n) | |

A_abs | A = Elliptic arc (not used) |

A_rel |

Show n => Show (PathCommand n) # | |