1
0
Fork 0
forked from forgejo/forgejo

Update github.com/issue9/identicon from untagged to v1.0.1 (#11359)

Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
6543 2020-05-10 12:23:17 +02:00 committed by GitHub
parent dbb74978f7
commit 57b6f83191
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 51 deletions

View file

@ -21,14 +21,14 @@ var (
blocks = []blockFunc{b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16}
)
// 所有block函数的类型
// 所有 block 函数的类型
type blockFunc func(img *image.Paletted, x, y, size float64, angle int)
// 将多边形points旋转angle个角度然后输出到img上起点为x,y坐标
// 将多边形 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的偏移值不能少,否则坐靠右,非正中央
if angle > 0 { // 0 角度不需要转换
// 中心坐标与 x、y 的距离,方便下面指定中心坐标(x+m,y+m)
// 0.5 的偏移值不能少,否则坐靠右,非正中央
m := size/2 - 0.5
rotate(points, x+m, y+m, angle)
}