[Vendor] Update directly used dependencys (#15593)

* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3

* github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0

* github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2

* github.com/go-chi/cors v1.1.1 -> v1.2.0

* github.com/go-git/go-billy v5.0.0 -> v5.1.0

* github.com/go-git/go-git v5.2.0 -> v5.3.0

* github.com/go-ldap/ldap v3.2.4 -> v3.3.0

* github.com/go-redis/redis v8.6.0 -> v8.8.2

* github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0

* github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0

* github.com/lib/pq v1.9.0 -> v1.10.1

* github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7

* github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0

* github.com/issue9/identicon v1.0.1 -> v1.2.0

* github.com/klauspost/compress v1.11.8 -> v1.12.1

* github.com/mgechev/revive v1.0.3 -> v1.0.6

* github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8

* github.com/niklasfasching/go-org v1.4.0 -> v1.5.0

* github.com/olivere/elastic v7.0.22 -> v7.0.24

* github.com/pelletier/go-toml v1.8.1 -> v1.9.0

* github.com/prometheus/client_golang v1.9.0 -> v1.10.0

* github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0

* github.com/yuin/goldmark v1.3.3 -> v1.3.5

* github.com/6543/go-version v1.2.4 -> v1.3.1

* do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
6543 2021-04-23 02:08:53 +02:00 committed by GitHub
parent 834fc74873
commit 792b4dba2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
558 changed files with 32080 additions and 24669 deletions

View file

@ -1,42 +1,33 @@
// Copyright 2015 by caixw, All rights reserved
// Use of this source code is governed by a MIT
// license that can be found in the LICENSE file.
// SPDX-License-Identifier: MIT
package identicon
import (
"image"
"sync"
)
var pool = sync.Pool{
New: func() interface{} { return make([]float64, 0, 10) },
}
import "image"
var (
// 可以出现在中间的方块,一般为了美观,都是对称图像。
centerBlocks = []blockFunc{b0, b1, b2, b3}
centerBlocks = []blockFunc{b0, b1, b2, b3, b19, b26, b27}
// 所有方块
blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16}
blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27}
)
// 所有 block 函数的类型
type blockFunc func(img *image.Paletted, x, y, size float64, angle int)
type blockFunc func(img *image.Paletted, x, y, size int, angle int)
// 将多边形 points 旋转 angle 个角度,然后输出到 img 上,起点为 x,y 坐标
func drawBlock(img *image.Paletted, x, y, size float64, angle int, points []float64) {
//
// points 中的坐标是基于左上角是原点的坐标系。
func drawBlock(img *image.Paletted, x, y, size int, angle int, points []int) {
if angle > 0 { // 0 角度不需要转换
// 中心坐标与 x、y 的距离,方便下面指定中心坐标(x+m,y+m)
// 0.5 的偏移值不能少,否则坐标靠右,非正中央
m := size/2 - 0.5
rotate(points, x+m, y+m, angle)
m := size / 2
rotate(points, m, m, angle)
}
for i := x; i < x+size; i++ {
for j := y; j < y+size; j++ {
for i := 0; i < size; i++ {
for j := 0; j < size; j++ {
if pointInPolygon(i, j, points) {
img.SetColorIndex(int(i), int(j), 1)
img.SetColorIndex(x+i, y+j, 1)
}
}
}
@ -49,8 +40,7 @@ func drawBlock(img *image.Paletted, x, y, size float64, angle int, points []floa
// | |
// | |
// --------
func b0(img *image.Paletted, x, y, size float64, angle int) {
}
func b0(img *image.Paletted, x, y, size int, angle int) {}
// 全填充正方形
//
@ -59,12 +49,9 @@ func b0(img *image.Paletted, x, y, size float64, angle int) {
// |######|
// |######|
// --------
func b1(img *image.Paletted, x, y, size float64, angle int) {
isize := int(size)
ix := int(x)
iy := int(y)
for i := ix + 1; i < ix+isize; i++ {
for j := iy + 1; j < iy+isize; j++ {
func b1(img *image.Paletted, x, y, size int, angle int) {
for i := x; i < x+size; i++ {
for j := y; j < y+size; j++ {
img.SetColorIndex(i, j, 1)
}
}
@ -77,14 +64,14 @@ func b1(img *image.Paletted, x, y, size float64, angle int) {
// | #### |
// | |
// ----------
func b2(img *image.Paletted, x, y, size float64, angle int) {
func b2(img *image.Paletted, x, y, size int, angle int) {
l := size / 4
x = x + l
y = y + l
for i := x; i < x+2*l; i++ {
for j := y; j < y+2*l; j++ {
img.SetColorIndex(int(i), int(j), 1)
img.SetColorIndex(i, j, 1)
}
}
}
@ -100,19 +87,15 @@ func b2(img *image.Paletted, x, y, size float64, angle int) {
// | ### |
// | # |
// ---------
func b3(img *image.Paletted, x, y, size float64, angle int) {
func b3(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
points := pool.Get().([]float64)[:0]
drawBlock(img, x, y, size, 0, append(points,
x+m, y,
x+size, y+m,
x+m, y+size,
x, y+m,
x+m, y,
))
pool.Put(points)
drawBlock(img, x, y, size, 0, []int{
m, 0,
size, m,
m, size,
0, m,
m, 0,
})
}
// b4
@ -124,16 +107,13 @@ func b3(img *image.Paletted, x, y, size float64, angle int) {
// |## |
// |# |
// |------
func b4(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+size, y,
x, y+size,
x, y,
))
pool.Put(points)
func b4(img *image.Paletted, x, y, size int, angle int) {
drawBlock(img, x, y, size, angle, []int{
0, 0,
size, 0,
0, size,
0, 0,
})
}
// b5
@ -143,18 +123,14 @@ func b4(img *image.Paletted, x, y, size float64, angle int) {
// | ### |
// | ##### |
// |#######|
func b5(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b5(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x+m, y,
x+size,
y+size,
x, y+size,
x+m, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
m, 0,
size, size,
0, size,
m, 0,
})
}
// b6 矩形
@ -164,18 +140,15 @@ func b5(img *image.Paletted, x, y, size float64, angle int) {
// |### |
// |### |
// --------
func b6(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b6(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+m, y,
x+m, y+size,
x, y+size,
x, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
m, size,
0, size,
0, 0,
})
}
// b7 斜放的锥形
@ -186,18 +159,15 @@ func b6(img *image.Paletted, x, y, size float64, angle int) {
// | #####|
// | ####|
// |--------
func b7(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b7(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+size, y+m,
x+size, y+size,
x+m, y+size,
x, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, 0,
size, m,
size, size,
m, size,
0, 0,
})
}
// b8 三个堆叠的三角形
@ -210,36 +180,33 @@ func b7(img *image.Paletted, x, y, size float64, angle int) {
// | ### ### |
// |#########|
// -----------
func b8(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b8(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
mm := m / 2
// 顶部三角形
drawBlock(img, x, y, size, angle, append(points,
x+m, y,
x+3*mm, y+m,
x+mm, y+m,
x+m, y,
))
drawBlock(img, x, y, size, angle, []int{
m, 0,
3 * mm, m,
mm, m,
m, 0,
})
// 底下左边
drawBlock(img, x, y, size, angle, append(points[:0],
x+mm, y+m,
x+m, y+size,
x, y+size,
x+mm, y+m,
))
drawBlock(img, x, y, size, angle, []int{
mm, m,
m, size,
0, size,
mm, m,
})
// 底下右边
drawBlock(img, x, y, size, angle, append(points[:0],
x+3*mm, y+m,
x+size, y+size,
x+m, y+size,
x+3*mm, y+m,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
3 * mm, m,
size, size,
m, size,
3 * mm, m,
})
}
// b9 斜靠的三角形
@ -251,17 +218,14 @@ func b8(img *image.Paletted, x, y, size float64, angle int) {
// | #### |
// | # |
// ---------
func b9(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b9(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+size, y+m,
x+m, y+size,
x, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, 0,
size, m,
m, size,
0, 0,
})
}
// b10
@ -276,24 +240,21 @@ func b9(img *image.Paletted, x, y, size float64, angle int) {
// |## |
// |# |
// ----------
func b10(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b10(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x+m, y,
x+size, y,
x+m, y+m,
x+m, y,
))
drawBlock(img, x, y, size, angle, []int{
m, 0,
size, 0,
m, m,
m, 0,
})
drawBlock(img, x, y, size, angle, append(points[:0],
x, y+m,
x+m, y+m,
x, y+size,
x, y+m,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, m,
m, m,
0, size,
0, m,
})
}
// b11 左上角1/4大小的方块
@ -305,18 +266,15 @@ func b10(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ----------
func b11(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b11(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+m, y,
x+m, y+m,
x, y+m,
x, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
m, m,
0, m,
0, 0,
})
}
// b12
@ -328,17 +286,14 @@ func b11(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// | # |
// -----------
func b12(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b12(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y+m,
x+size, y+m,
x+m, y+size,
x, y+m,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, m,
size, m,
m, size,
0, m,
})
}
// b13
@ -350,17 +305,14 @@ func b12(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// |#########|
// -----------
func b13(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b13(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x+m, y+m,
x+size, y+size,
x, y+size,
x+m, y+m,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
m, m,
size, size,
0, size,
m, m,
})
}
// b14
@ -372,17 +324,14 @@ func b13(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ---------
func b14(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b14(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x+m, y,
x+m, y+m,
x, y+m,
x+m, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
m, 0,
m, m,
0, m,
m, 0,
})
}
// b15
@ -394,17 +343,14 @@ func b14(img *image.Paletted, x, y, size float64, angle int) {
// | |
// | |
// ----------
func b15(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b15(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x, y,
x+m, y,
x, y+m,
x, y,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
0, m,
0, 0,
})
}
// b16
@ -417,22 +363,354 @@ func b15(img *image.Paletted, x, y, size float64, angle int) {
// | ##### |
// |#######|
// ---------
func b16(img *image.Paletted, x, y, size float64, angle int) {
points := pool.Get().([]float64)[:0]
func b16(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, append(points,
x+m, y,
x+size, y+m,
x, y+m,
x+m, y,
))
drawBlock(img, x, y, size, angle, []int{
m, 0,
size, m,
0, m,
m, 0,
})
drawBlock(img, x, y, size, angle, append(points[:0],
x+m, y+m,
x+size, y+size,
x, y+size,
x+m, y+m,
))
pool.Put(points)
drawBlock(img, x, y, size, angle, []int{
m, m,
size, size,
0, size,
m, m,
})
}
// b17
//
// ----------
// |##### |
// |### |
// |# |
// | ##|
// | ##|
// ----------
func b17(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
0, m,
0, 0,
})
quarter := size / 4
drawBlock(img, x, y, size, angle, []int{
size - quarter, size - quarter,
size, size - quarter,
size, size,
size - quarter, size,
size - quarter, size - quarter,
})
}
// b18
//
// ----------
// |##### |
// |#### |
// |### |
// |## |
// |# |
// ----------
func b18(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
0, size,
0, 0,
})
}
// b19
//
// ----------
// |########|
// |### ###|
// |# #|
// |### ###|
// |########|
// ----------
func b19(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, 0,
0, m,
0, 0,
})
drawBlock(img, x, y, size, angle, []int{
m, 0,
size, 0,
size, m,
m, 0,
})
drawBlock(img, x, y, size, angle, []int{
size, m,
size, size,
m, size,
size, m,
})
drawBlock(img, x, y, size, angle, []int{
0, m,
m, size,
0, size,
0, m,
})
}
// b20
//
// ----------
// | ## |
// |### |
// |## |
// |## |
// |# |
// ----------
func b20(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
q, 0,
0, size,
0, m,
q, 0,
})
}
// b21
//
// ----------
// | #### |
// |## #####|
// |## ##|
// |## |
// |# |
// ----------
func b21(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
q, 0,
0, size,
0, m,
q, 0,
})
drawBlock(img, x, y, size, angle, []int{
q, 0,
size, q,
size, m,
q, 0,
})
}
// b22
//
// ----------
// | #### |
// |## ### |
// |## ##|
// |## ##|
// |# #|
// ----------
func b22(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
q, 0,
0, size,
0, m,
q, 0,
})
drawBlock(img, x, y, size, angle, []int{
q, 0,
size, q,
size, size,
q, 0,
})
}
// b23
//
// ----------
// | #######|
// |### #|
// |## |
// |## |
// |# |
// ----------
func b23(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
q, 0,
0, size,
0, m,
q, 0,
})
drawBlock(img, x, y, size, angle, []int{
q, 0,
size, 0,
size, q,
q, 0,
})
}
// b24
//
// ----------
// | ## ###|
// |### ###|
// |## ## |
// |## ## |
// |# # |
// ----------
func b24(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
q, 0,
0, size,
0, m,
q, 0,
})
drawBlock(img, x, y, size, angle, []int{
m, 0,
size, 0,
m, size,
m, 0,
})
}
// b25
//
// ----------
// |# #|
// |## ###|
// |## ## |
// |###### |
// |#### |
// ----------
func b25(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
0, 0,
0, size,
q, size,
0, 0,
})
drawBlock(img, x, y, size, angle, []int{
0, m,
size, 0,
q, size,
0, m,
})
}
// b26
//
// ----------
// |# #|
// |### ###|
// | #### |
// |### ###|
// |# #|
// ----------
func b26(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
0, 0,
m, q,
q, m,
0, 0,
})
drawBlock(img, x, y, size, angle, []int{
size, 0,
m + q, m,
m, q,
size, 0,
})
drawBlock(img, x, y, size, angle, []int{
size, size,
m, m + q,
q + m, m,
size, size,
})
drawBlock(img, x, y, size, angle, []int{
0, size,
q, m,
m, q + m,
0, size,
})
}
// b27
//
// ----------
// |########|
// |## ###|
// |# #|
// |### ##|
// |########|
// ----------
func b27(img *image.Paletted, x, y, size int, angle int) {
m := size / 2
q := size / 4
drawBlock(img, x, y, size, angle, []int{
0, 0,
size, 0,
0, q,
0, 0,
})
drawBlock(img, x, y, size, angle, []int{
q + m, 0,
size, 0,
size, size,
q + m, 0,
})
drawBlock(img, x, y, size, angle, []int{
size, q + m,
size, size,
0, size,
size, q + m,
})
drawBlock(img, x, y, size, angle, []int{
0, size,
0, 0,
q, size,
0, size,
})
}