Update github.com/issue9/identicon from untagged to v1.0.1 (#11359)
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
parent
dbb74978f7
commit
57b6f83191
12 changed files with 67 additions and 51 deletions
2
go.mod
2
go.mod
|
@ -54,7 +54,7 @@ require (
|
|||
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
|
||||
github.com/huandu/xstrings v1.3.0
|
||||
github.com/issue9/assert v1.3.2 // indirect
|
||||
github.com/issue9/identicon v0.0.0-20160320065130-d36b54562f4c
|
||||
github.com/issue9/identicon v1.0.1
|
||||
github.com/jaytaylor/html2text v0.0.0-20160923191438-8fb95d837f7d
|
||||
github.com/jmhodges/levigo v1.0.0 // indirect
|
||||
github.com/joho/godotenv v1.3.0 // indirect
|
||||
|
|
5
go.sum
5
go.sum
|
@ -372,10 +372,11 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO
|
|||
github.com/huandu/xstrings v1.3.0 h1:gvV6jG9dTgFEncxo+AF7PH6MZXi/vZl25owA/8Dg8Wo=
|
||||
github.com/huandu/xstrings v1.3.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/issue9/assert v1.3.1/go.mod h1:9Ger+iz8X7r1zMYYwEhh++2wMGWcNN2oVI+zIQXxcio=
|
||||
github.com/issue9/assert v1.3.2 h1:IaTa37u4m1fUuTH9K9ldO5IONKVDXjLiUO1T9vj0OF0=
|
||||
github.com/issue9/assert v1.3.2/go.mod h1:9Ger+iz8X7r1zMYYwEhh++2wMGWcNN2oVI+zIQXxcio=
|
||||
github.com/issue9/identicon v0.0.0-20160320065130-d36b54562f4c h1:A/PDn117UYld5mlxe58EpMguqpkeTMw5/FCo0ZPS/Ko=
|
||||
github.com/issue9/identicon v0.0.0-20160320065130-d36b54562f4c/go.mod h1:5mTb/PQNkqmq2x3IxlQZE0aSnTksJg7fg/oWmJ5SKXQ=
|
||||
github.com/issue9/identicon v1.0.1 h1:pCDfjMDM6xWK0Chxo8Lif+ST/nOEtmXgMITgV1YA9Og=
|
||||
github.com/issue9/identicon v1.0.1/go.mod h1:UKNVkUFI68RPz/RlLhsAr1aX6bBSaYEWRHVfdjrMUmk=
|
||||
github.com/jarcoal/httpmock v0.0.0-20180424175123-9c70cfe4a1da/go.mod h1:ks+b9deReOc7jgqp+e7LuFiCBH6Rm5hL32cLcEAArb4=
|
||||
github.com/jaytaylor/html2text v0.0.0-20160923191438-8fb95d837f7d h1:ig/iUfDDg06RVW8OMby+GrmW6K2nPO3AFHlEIdvJSd4=
|
||||
github.com/jaytaylor/html2text v0.0.0-20160923191438-8fb95d837f7d/go.mod h1:CVKlgaMiht+LXvHG173ujK6JUhZXKb2u/BQtjPDIvyk=
|
||||
|
|
2
vendor/github.com/issue9/identicon/.gitignore
generated
vendored
2
vendor/github.com/issue9/identicon/.gitignore
generated
vendored
|
@ -29,4 +29,4 @@ _testmain.go
|
|||
#osx
|
||||
.DS_Store
|
||||
|
||||
testdata
|
||||
/testdata/*.png
|
||||
|
|
24
vendor/github.com/issue9/identicon/.travis.yml
generated
vendored
24
vendor/github.com/issue9/identicon/.travis.yml
generated
vendored
|
@ -1,10 +1,20 @@
|
|||
language: go
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
- windows
|
||||
|
||||
go:
|
||||
- tip
|
||||
- 1.6
|
||||
- 1.5
|
||||
- 1.4
|
||||
- 1.3
|
||||
install:
|
||||
- go get github.com/issue9/assert
|
||||
- mkdir ./testdata
|
||||
- 1.12
|
||||
- 1.11
|
||||
|
||||
script:
|
||||
- GO111MODULE=on go test -v -coverprofile=coverage.txt -covermode=atomic ./...
|
||||
|
||||
after_success: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- go: tip
|
||||
|
|
7
vendor/github.com/issue9/identicon/README.md
generated
vendored
7
vendor/github.com/issue9/identicon/README.md
generated
vendored
|
@ -1,4 +1,5 @@
|
|||
identicon [![Build Status](https://travis-ci.org/issue9/identicon.svg?branch=master)](https://travis-ci.org/issue9/identicon)
|
||||
identicon
|
||||
[![Build Status](https://travis-ci.org/issue9/identicon.svg?branch=master)](https://travis-ci.org/issue9/identicon)
|
||||
======
|
||||
|
||||
根据用户的 IP 、邮箱名等任意数据为用户产生漂亮的随机头像。
|
||||
|
@ -31,10 +32,10 @@ go get github.com/issue9/identicon
|
|||
|
||||
### 文档
|
||||
|
||||
[![Go Walker](http://gowalker.org/api/v1/badge)](http://gowalker.org/github.com/issue9/identicon)
|
||||
[![Go Walker](https://gowalker.org/api/v1/badge)](https://gowalker.org/github.com/issue9/identicon)
|
||||
[![GoDoc](https://godoc.org/github.com/issue9/identicon?status.svg)](https://godoc.org/github.com/issue9/identicon)
|
||||
|
||||
|
||||
### 版权
|
||||
|
||||
本项目采用[MIT](http://opensource.org/licenses/MIT)开源授权许可证,完整的授权说明可在[LICENSE](LICENSE)文件中找到。
|
||||
本项目采用 [MIT](https://opensource.org/licenses/MIT) 开源授权许可证,完整的授权说明可在 [LICENSE](LICENSE) 文件中找到。
|
||||
|
|
4
vendor/github.com/issue9/identicon/block.go
generated
vendored
4
vendor/github.com/issue9/identicon/block.go
generated
vendored
|
@ -27,8 +27,8 @@ type blockFunc func(img *image.Paletted, x, y, size float64, angle int)
|
|||
// 将多边形 points 旋转 angle 个角度,然后输出到 img 上,起点为 x,y 坐标
|
||||
func drawBlock(img *image.Paletted, x, y, size float64, angle int, points []float64) {
|
||||
if angle > 0 { // 0 角度不需要转换
|
||||
// 中心坐标与x,y的距离,方便下面指定中心坐标(x+m,y+m),
|
||||
// 0.5的偏移值不能少,否则坐靠右,非正中央
|
||||
// 中心坐标与 x、y 的距离,方便下面指定中心坐标(x+m,y+m),
|
||||
// 0.5 的偏移值不能少,否则坐标靠右,非正中央
|
||||
m := size/2 - 0.5
|
||||
rotate(points, x+m, y+m, angle)
|
||||
}
|
||||
|
|
4
vendor/github.com/issue9/identicon/doc.go
generated
vendored
4
vendor/github.com/issue9/identicon/doc.go
generated
vendored
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by a MIT
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// 一个基于hash值生成随机图像的包。
|
||||
// Package identicon 一个基于 hash 值生成随机图像的包。
|
||||
//
|
||||
// 关于identicon并没有统一的标准,一般用于在用户注册时,
|
||||
// identicon 并没有统一的标准,一般用于在用户注册时,
|
||||
// 取用户的邮箱或是访问 IP 等数据(也可以是其它任何数据),
|
||||
// 进行 hash 运算,之后根据 hash 数据,产生一张图像,
|
||||
// 这样即可以为用户产生一张独特的头像,又不会泄漏用户的隐藏。
|
||||
|
|
3
vendor/github.com/issue9/identicon/go.mod
generated
vendored
Normal file
3
vendor/github.com/issue9/identicon/go.mod
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
module github.com/issue9/identicon
|
||||
|
||||
require github.com/issue9/assert v1.3.1
|
2
vendor/github.com/issue9/identicon/go.sum
generated
vendored
Normal file
2
vendor/github.com/issue9/identicon/go.sum
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
github.com/issue9/assert v1.3.1 h1:L8pRpbnzMIPFJqrMKR/oG03uWrtVeZyYBpI2U2Jx1JE=
|
||||
github.com/issue9/assert v1.3.1/go.mod h1:9Ger+iz8X7r1zMYYwEhh++2wMGWcNN2oVI+zIQXxcio=
|
19
vendor/github.com/issue9/identicon/identicon.go
generated
vendored
19
vendor/github.com/issue9/identicon/identicon.go
generated
vendored
|
@ -25,11 +25,10 @@ type Identicon struct {
|
|||
rect image.Rectangle
|
||||
}
|
||||
|
||||
// 声明一个Identicon实例。
|
||||
// size表示整个头像的大小。
|
||||
// back表示前景色。
|
||||
// New 声明一个 Identicon 实例。
|
||||
// size 表示整个头像的大小;
|
||||
// back 表示前景色;
|
||||
// fore 表示所有可能的前景色,会为每个图像随机挑选一个作为其前景色。
|
||||
// NOTE:前景色不要与背景色太相近。
|
||||
func New(size int, back color.Color, fore ...color.Color) (*Identicon, error) {
|
||||
if len(fore) == 0 || len(fore) > maxForeColors {
|
||||
return nil, fmt.Errorf("前景色数量必须介于[1]~[%v]之间,当前为[%v]", maxForeColors, len(fore))
|
||||
|
@ -49,7 +48,7 @@ func New(size int, back color.Color, fore ...color.Color) (*Identicon, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
// 根据data数据产生一张唯一性的头像图片。
|
||||
// Make 根据 data 数据产生一张唯一性的头像图片。
|
||||
func (i *Identicon) Make(data []byte) image.Image {
|
||||
h := md5.New()
|
||||
h.Write(data)
|
||||
|
@ -78,7 +77,7 @@ func (i *Identicon) Make(data []byte) image.Image {
|
|||
return p
|
||||
}
|
||||
|
||||
// 根据data数据产生一张唯一性的头像图片。
|
||||
// Make 根据 data 数据产生一张唯一性的头像图片。
|
||||
// size 头像的大小。
|
||||
// back, fore头像的背景和前景色。
|
||||
func Make(size int, back, fore color.Color, data []byte) (image.Image, error) {
|
||||
|
@ -112,10 +111,10 @@ func Make(size int, back, fore color.Color, data []byte) (image.Image, error) {
|
|||
}
|
||||
|
||||
// 将九个方格都填上内容。
|
||||
// p为画板。
|
||||
// c为中间方格的填充函数。
|
||||
// b1,b2为边上8格的填充函数。
|
||||
// angle为b1,b2的起始旋转角度。
|
||||
// p 为画板;
|
||||
// c 为中间方格的填充函数;
|
||||
// b1、b2 为边上 8 格的填充函数;
|
||||
// angle 为 b1、b2 的起始旋转角度。
|
||||
func drawBlocks(p *image.Paletted, size int, c, b1, b2 blockFunc, angle int) {
|
||||
// 每个格子的长宽。先转换成 float,再计算!
|
||||
blockSize := float64(size) / 3
|
||||
|
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
@ -387,7 +387,7 @@ github.com/hashicorp/hcl/json/token
|
|||
github.com/huandu/xstrings
|
||||
# github.com/issue9/assert v1.3.2
|
||||
## explicit
|
||||
# github.com/issue9/identicon v0.0.0-20160320065130-d36b54562f4c
|
||||
# github.com/issue9/identicon v1.0.1
|
||||
## explicit
|
||||
github.com/issue9/identicon
|
||||
# github.com/jaytaylor/html2text v0.0.0-20160923191438-8fb95d837f7d
|
||||
|
|
Reference in a new issue