func (cv *Canvas) StrokePath(path *Path2D) {
	path2 := Path2D{
		p: make([]pathPoint, len(path.p)),
	}
	copy(path2.p, path.p)
	cv.strokePath(&path2, cv.state.transform, backendbase.Mat{}, false)
}
StrokePath uses the current StrokeStyle to draw the given path
package canvas
import (
	"math"
	"github.com/tfriedel6/canvas/backend/backendbase"
)
func (cv *Canvas) BeginPath() {
	if cv.path.p == nil {
		cv.path.p = make([]pathPoint, 0, 100)
	}
	cv.path.p = cv.path.p[:0]
}
func isSamePoint(a, b backendbase.Vec, maxDist float64) bool {
	return math.Abs(b[0]-a[0]) <= maxDist && math.Abs(b[1]-a[1]) <= maxDist
}
func (cv *Canvas) MoveTo(x, y float64) {
	tf := cv.tf(backendbase.Vec{x, y})
	cv.path.MoveTo(tf[0], tf[1])
}
func (cv *Canvas) LineTo(x, y float64) {
	tf := cv.tf(backendbase.Vec{x, y})
	cv.path.LineTo(tf[0], tf[1])
}
func (cv *Canvas) Arc(x, y, radius, startAngle, endAngle float64, anticlockwise bool) {
	ax, ay := math.Sincos(startAngle)
	startAngle2 := backendbase.Vec{ay, ax}.MulMat2(cv.state.transform.Mat2()).Atan2()
	endAngle2 := startAngle2 + (endAngle - startAngle)
	cv.path.arc(x, y, radius, startAngle2, endAngle2, anticlockwise, cv.state.transform, false)
}
func (cv *Canvas) ArcTo(x1, y1, x2, y2, radius float64) {
	cv.path.arcTo(x1, y1, x2, y2, radius, cv.state.transform, false)
}
func (cv *Canvas) QuadraticCurveTo(x1, y1, x2, y2 float64) {
	tf1 := cv.tf(backendbase.Vec{x1, y1})
	tf2 := cv.tf(backendbase.Vec{x2, y2})
	cv.path.QuadraticCurveTo(tf1[0], tf1[1], tf2[0], tf2[1])
}
func (cv *Canvas) BezierCurveTo(x1, y1, x2, y2, x3, y3 float64) {
	tf1 := cv.tf(backendbase.Vec{x1, y1})
	tf2 := cv.tf(backendbase.Vec{x2, y2})
	tf3 := cv.tf(backendbase.Vec{x3, y3})
	cv.path.BezierCurveTo(tf1[0], tf1[1], tf2[0], tf2[1], tf3[0], tf3[1])
}
func (cv *Canvas) Ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle float64, anticlockwise bool) {
	tf := cv.tf(backendbase.Vec{x, y})
	ax, ay := math.Sincos(startAngle)
	startAngle2 := backendbase.Vec{ay, ax}.MulMat2(cv.state.transform.Mat2()).Atan2()
	endAngle2 := startAngle2 + (endAngle - startAngle)
	cv.path.Ellipse(tf[0], tf[1], radiusX, radiusY, rotation, startAngle2, endAngle2, anticlockwise)
}
func (cv *Canvas) ClosePath() {
	cv.path.ClosePath()
}
func (cv *Canvas) Stroke() {
	cv.strokePath(&cv.path, cv.state.transform, cv.state.transform.Invert(), true)
}