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 /svgwrite.go | |
parent | 936c634e15265fb3c7239e07c71fc3c6ac027d98 (diff) |
added closepath support in SVG
Diffstat (limited to 'svgwrite.go')
-rw-r--r-- | svgwrite.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/svgwrite.go b/svgwrite.go index d438393..7045199 100644 --- a/svgwrite.go +++ b/svgwrite.go @@ -29,6 +29,7 @@ func (f *Fpdf) SVGBasicWrite(sb *SVGBasicType, scale float64) { var cx0, cy0, cx1, cy1 float64 var path []SVGBasicSegmentType var seg SVGBasicSegmentType + var startX, startY float64 sval := func(origin float64, arg int) float64 { return origin + scale*seg.Arg[arg] } @@ -48,6 +49,7 @@ func (f *Fpdf) SVGBasicWrite(sb *SVGBasicType, scale float64) { switch seg.Cmd { case 'M': x, y = val(0) + startX, startY = x, y f.SetXY(x, y) case 'L': newX, newY = val(0) @@ -73,7 +75,7 @@ func (f *Fpdf) SVGBasicWrite(sb *SVGBasicType, scale float64) { f.Line(x, y, x, newY) y = newY case 'Z': - f.Line(x, y, originX, originY) + f.Line(x, y, startX, startY) default: f.SetErrorf("Unexpected path command '%c'", seg.Cmd) } |