dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit a2afb50c39a86ba3beb1fd8c1877f396d9e68d51
parent 6919280a55dfe8341ec294c69e4926f7466e7a62
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 28 May 2023 00:32:03 -0700

cleanup

Diffstat:
Mpkg/captcha/image.go | 16+++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/pkg/captcha/image.go b/pkg/captcha/image.go @@ -612,17 +612,14 @@ func (m *Image) strokeCubicLine(p1, p2 Point, d float64) { m.c.Stroke() } -func (m *Image) renderPath(points []Point) { +func (m *Image) renderPath(points Points) { d := m.CubicDelta gradColors := m.getGradientColors(len(points)) // Draw the whole line m.withState(func() { - for i := 1; i < len(points); i++ { - prev := points[i-1] - pt := points[i] - + points.Pairs(func(i int, prev, pt Point) { grad := getGradient(prev, pt, gradColors, i) m.c.SetStrokeStyle(grad) //m.c.SetColor(color.White) @@ -637,16 +634,13 @@ func (m *Image) renderPath(points []Point) { m.c.SetLineWidth(1.5) m.strokeCubicLine(prev, pt, d) }) - } + }) }) m.withState(func() { m.c.SetLineWidth(1.5) m.c.SetDash(10, 300) - for i := 1; i < len(points); i++ { - prev := points[i-1] - pt := points[i] - + points.Pairs(func(i int, prev, pt Point) { grad := getGradient(prev, pt, gradColors, i) m.c.SetStrokeStyle(grad) //m.c.SetColor(color.RGBA{255, 0, 0, 255}) @@ -670,7 +664,7 @@ func (m *Image) renderPath(points []Point) { m.strokeCubicLine(pt, prev, -d) }) } - } + }) }) }