diff options
author | Richard Stöckl <richard.stoeckl@aon.at> | 2019-08-28 19:05:11 +0200 |
---|---|---|
committer | Richard Stöckl <richard.stoeckl@aon.at> | 2019-08-28 19:05:11 +0200 |
commit | 761de3879c5b4b3e0b7d2d9d30ced3aa56f8a39d (patch) | |
tree | a5610392f59f6d5a6b66a74bd7da3402f998526c /svgbasic.go | |
parent | 936c634e15265fb3c7239e07c71fc3c6ac027d98 (diff) |
added closepath support in SVG
Diffstat (limited to 'svgbasic.go')
-rw-r--r-- | svgbasic.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/svgbasic.go b/svgbasic.go index 0eea754..51a93fe 100644 --- a/svgbasic.go +++ b/svgbasic.go @@ -34,7 +34,8 @@ func init() { "M", " M ", "m", " m ", "H", " H ", "h", " h ", "V", " V ", "v", " v ", - "Q", " Q ", "q", " q ", ) + "Q", " Q ", "q", " q ", + "Z", " Z ", "z", " z ") } // SVGBasicSegmentType describes a single curve or position segment @@ -103,7 +104,8 @@ func absolutizePath(segs []SVGBasicSegmentType) { segPtr.Arg[0] += y segPtr.Cmd = 'V' y += seg.Arg[0] - + case 'z': + segPtr.Cmd = 'Z' } } } @@ -161,7 +163,7 @@ func pathParse(pathStr string) (segs []SVGBasicSegmentType, err error) { case 'V', 'v': // Absolute/relative vertical line to: x setup(1) case 'Z', 'z': // closepath instruction (takes no arguments) - break + segs = append(segs, seg) default: err = fmt.Errorf("expecting SVG path command at position %d, got %s", j, str) } |