commit 639b6a27245658ef78837e01ff877daf39a809e6
parent 010644d2cd24d8427f8110d7230fb00b0971453a
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 27 May 2023 23:07:39 -0700
deindent code
Diffstat:
| M | pkg/captcha/image.go | | | 88 | +++++++++++++++++++++++++++++++++++++++---------------------------------------- |
1 file changed, 43 insertions(+), 45 deletions(-)
diff --git a/pkg/captcha/image.go b/pkg/captcha/image.go
@@ -610,62 +610,60 @@ func (m *Image) renderPath(points []Point) {
gradColors := m.getGradientColors(len(points))
+ // Draw the whole line
m.withState(func() {
- // Draw the whole line
- m.withState(func() {
- for i := 1; i < len(points); i++ {
- prev := points[i-1]
- pt := points[i]
+ for i := 1; i < len(points); i++ {
+ prev := points[i-1]
+ pt := points[i]
- grad := getGradient(prev, pt, gradColors, i)
- m.c.SetStrokeStyle(grad)
- //m.c.SetColor(color.White)
+ grad := getGradient(prev, pt, gradColors, i)
+ m.c.SetStrokeStyle(grad)
+ //m.c.SetColor(color.White)
+
+ m.withState(func() {
+ m.c.SetLineWidth(4)
+ m.c.SetColor(color.RGBA{R: 15, G: 15, B: 15, A: 255})
+ m.strokeCubicLine(prev, pt, d)
+ })
+
+ m.withState(func() {
+ 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]
+
+ grad := getGradient(prev, pt, gradColors, i)
+ m.c.SetStrokeStyle(grad)
+ //m.c.SetColor(color.RGBA{255, 0, 0, 255})
+ m.strokeCubicLine(prev, pt, d)
+
+ if i == len(points)-1 {
m.withState(func() {
m.c.SetLineWidth(4)
m.c.SetColor(color.RGBA{R: 15, G: 15, B: 15, A: 255})
- m.strokeCubicLine(prev, pt, d)
+ m.strokeCubicLine(pt, prev, -d)
})
m.withState(func() {
- m.c.SetLineWidth(1.5)
- m.strokeCubicLine(prev, pt, d)
+ m.c.SetDashOffset(4)
+ m.c.SetDash(30, 300)
+ m.strokeCubicLine(pt, prev, -d)
+ })
+ } else {
+ m.withState(func() {
+ m.strokeCubicLine(pt, prev, -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]
-
- grad := getGradient(prev, pt, gradColors, i)
- m.c.SetStrokeStyle(grad)
- //m.c.SetColor(color.RGBA{255, 0, 0, 255})
-
- m.strokeCubicLine(prev, pt, d)
-
- if i == len(points)-1 {
- m.withState(func() {
- m.c.SetLineWidth(4)
- m.c.SetColor(color.RGBA{R: 15, G: 15, B: 15, A: 255})
- m.strokeCubicLine(pt, prev, -d)
- })
-
- m.withState(func() {
- m.c.SetDashOffset(4)
- m.c.SetDash(30, 300)
- m.strokeCubicLine(pt, prev, -d)
- })
- } else {
- m.withState(func() {
- m.strokeCubicLine(pt, prev, -d)
- })
- }
- }
- })
+ }
})
}