From d256eaa84642299caf54b8cb6339d199c6ed3bc3 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 16 Mar 2020 23:49:55 +0900 Subject: [PATCH] vector: Add comments --- vector/path.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vector/path.go b/vector/path.go index a41cf55e1..1752bd744 100644 --- a/vector/path.go +++ b/vector/path.go @@ -55,6 +55,7 @@ func (p *Path) LineTo(x, y float32) { p.cur = triangulate.Point{X: x, Y: y} } +// nseg returns a number of segments based on the given two points (x0, y0) and (x1, y1). func nseg(x0, y0, x1, y1 float32) int { distx := x1 - x0 if distx < 0 { @@ -72,6 +73,7 @@ func nseg(x0, y0, x1, y1 float32) int { return int(math.Ceil(float64(dist))) } +// QuadTo adds a quadratic Bézier curve to the path. func (p *Path) QuadTo(cpx, cpy, x, y float32) { c := p.cur num := nseg(c.X, c.Y, x, y) @@ -82,6 +84,7 @@ func (p *Path) QuadTo(cpx, cpy, x, y float32) { } } +// CubicTo adds a cubic Bézier curve to the path. func (p *Path) CubicTo(cp0x, cp0y, cp1x, cp1y, x, y float32) { c := p.cur num := nseg(c.X, c.Y, x, y) @@ -92,7 +95,9 @@ func (p *Path) CubicTo(cp0x, cp0y, cp1x, cp1y, x, y float32) { } } +// FillOptions represents options to fill a path. type FillOptions struct { + // Color is a color to fill with. Color color.Color }