2021-11-19 22:40:41 +05:30
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Copied and modified from https://github.com/issue9/identicon/ (MIT License)
|
2016-11-04 03:46:01 +05:30
|
|
|
|
|
|
|
package identicon
|
|
|
|
|
2021-04-23 05:38:53 +05:30
|
|
|
import "image"
|
2016-11-04 03:46:01 +05:30
|
|
|
|
|
|
|
var (
|
2021-11-19 22:40:41 +05:30
|
|
|
// the blocks can appear in center, these blocks can be more beautiful
|
2021-04-23 05:38:53 +05:30
|
|
|
centerBlocks = []blockFunc{b0, b1, b2, b3, b19, b26, b27}
|
2016-11-04 03:46:01 +05:30
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// all blocks
|
2021-04-23 05:38:53 +05:30
|
|
|
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}
|
2016-11-04 03:46:01 +05:30
|
|
|
)
|
|
|
|
|
2021-12-20 10:11:31 +05:30
|
|
|
type blockFunc func(img *image.Paletted, x, y, size, angle int)
|
2016-11-04 03:46:01 +05:30
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// draw a polygon by points, and the polygon is rotated by angle.
|
2021-12-20 10:11:31 +05:30
|
|
|
func drawBlock(img *image.Paletted, x, y, size, angle int, points []int) {
|
2021-11-19 22:40:41 +05:30
|
|
|
if angle != 0 {
|
2021-04-23 05:38:53 +05:30
|
|
|
m := size / 2
|
|
|
|
rotate(points, m, m, angle)
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-04-23 05:38:53 +05:30
|
|
|
for i := 0; i < size; i++ {
|
|
|
|
for j := 0; j < size; j++ {
|
2016-11-04 03:46:01 +05:30
|
|
|
if pointInPolygon(i, j, points) {
|
2021-04-23 05:38:53 +05:30
|
|
|
img.SetColorIndex(x+i, y+j, 1)
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// blank
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// --------
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// --------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b0(img *image.Paletted, x, y, size, angle int) {}
|
2016-11-04 03:46:01 +05:30
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// full-filled
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// --------
|
|
|
|
// |######|
|
|
|
|
// |######|
|
|
|
|
// |######|
|
|
|
|
// --------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b1(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
for i := x; i < x+size; i++ {
|
|
|
|
for j := y; j < y+size; j++ {
|
2016-11-04 03:46:01 +05:30
|
|
|
img.SetColorIndex(i, j, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// a small block
|
2016-11-04 03:46:01 +05:30
|
|
|
// ----------
|
|
|
|
// | |
|
|
|
|
// | #### |
|
|
|
|
// | #### |
|
|
|
|
// | |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b2(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
l := size / 4
|
2021-11-19 22:40:41 +05:30
|
|
|
x += l
|
|
|
|
y += l
|
2016-11-04 03:46:01 +05:30
|
|
|
|
|
|
|
for i := x; i < x+2*l; i++ {
|
|
|
|
for j := y; j < y+2*l; j++ {
|
2021-04-23 05:38:53 +05:30
|
|
|
img.SetColorIndex(i, j, 1)
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// diamond
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// | # |
|
|
|
|
// | ### |
|
|
|
|
// | ##### |
|
|
|
|
// |#######|
|
|
|
|
// | ##### |
|
|
|
|
// | ### |
|
|
|
|
// | # |
|
|
|
|
// ---------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b3(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, 0, []int{
|
|
|
|
m, 0,
|
|
|
|
size, m,
|
|
|
|
m, size,
|
|
|
|
0, m,
|
|
|
|
m, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b4
|
|
|
|
//
|
|
|
|
// -------
|
|
|
|
// |#####|
|
|
|
|
// |#### |
|
|
|
|
// |### |
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// |------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b4(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
size, 0,
|
|
|
|
0, size,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b5
|
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// | # |
|
|
|
|
// | ### |
|
|
|
|
// | ##### |
|
|
|
|
// |#######|
|
2021-12-20 10:11:31 +05:30
|
|
|
func b5(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, 0,
|
|
|
|
size, size,
|
|
|
|
0, size,
|
|
|
|
m, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// b6
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// --------
|
|
|
|
// |### |
|
|
|
|
// |### |
|
|
|
|
// |### |
|
|
|
|
// --------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b6(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
m, 0,
|
|
|
|
m, size,
|
|
|
|
0, size,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// b7 italic cone
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// | # |
|
|
|
|
// | ## |
|
|
|
|
// | #####|
|
|
|
|
// | ####|
|
|
|
|
// |--------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b7(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
size, m,
|
|
|
|
size, size,
|
|
|
|
m, size,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// b8 three small triangles
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// -----------
|
|
|
|
// | # |
|
|
|
|
// | ### |
|
|
|
|
// | ##### |
|
|
|
|
// | # # |
|
|
|
|
// | ### ### |
|
|
|
|
// |#########|
|
|
|
|
// -----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b8(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
|
|
|
mm := m / 2
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// top
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, 0,
|
|
|
|
3 * mm, m,
|
|
|
|
mm, m,
|
|
|
|
m, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// bottom left
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
mm, m,
|
|
|
|
m, size,
|
|
|
|
0, size,
|
|
|
|
mm, m,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// bottom right
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
3 * mm, m,
|
|
|
|
size, size,
|
|
|
|
m, size,
|
|
|
|
3 * mm, m,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// b9 italic triangle
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// |# |
|
|
|
|
// | #### |
|
|
|
|
// | #####|
|
|
|
|
// | #### |
|
|
|
|
// | # |
|
|
|
|
// ---------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b9(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
size, m,
|
|
|
|
m, size,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b10
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | ####|
|
|
|
|
// | ### |
|
|
|
|
// | ## |
|
|
|
|
// | # |
|
|
|
|
// |#### |
|
|
|
|
// |### |
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b10(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, 0,
|
|
|
|
size, 0,
|
|
|
|
m, m,
|
|
|
|
m, 0,
|
|
|
|
})
|
|
|
|
|
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, m,
|
|
|
|
m, m,
|
|
|
|
0, size,
|
|
|
|
0, m,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
2021-11-19 22:40:41 +05:30
|
|
|
// b11
|
2016-11-04 03:46:01 +05:30
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |#### |
|
|
|
|
// |#### |
|
|
|
|
// |#### |
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b11(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
m, 0,
|
|
|
|
m, m,
|
|
|
|
0, m,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b12
|
|
|
|
//
|
|
|
|
// -----------
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// |#########|
|
|
|
|
// | ##### |
|
|
|
|
// | # |
|
|
|
|
// -----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b12(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, m,
|
|
|
|
size, m,
|
|
|
|
m, size,
|
|
|
|
0, m,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b13
|
|
|
|
//
|
|
|
|
// -----------
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// | # |
|
|
|
|
// | ##### |
|
|
|
|
// |#########|
|
|
|
|
// -----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b13(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, m,
|
|
|
|
size, size,
|
|
|
|
0, size,
|
|
|
|
m, m,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b14
|
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// | # |
|
|
|
|
// | ### |
|
|
|
|
// |#### |
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// ---------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b14(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, 0,
|
|
|
|
m, m,
|
|
|
|
0, m,
|
|
|
|
m, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b15
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |##### |
|
|
|
|
// |### |
|
|
|
|
// |# |
|
|
|
|
// | |
|
|
|
|
// | |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b15(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
m, 0,
|
|
|
|
0, m,
|
|
|
|
0, 0,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
// b16
|
|
|
|
//
|
|
|
|
// ---------
|
|
|
|
// | # |
|
|
|
|
// | ##### |
|
|
|
|
// |#######|
|
|
|
|
// | # |
|
|
|
|
// | ##### |
|
|
|
|
// |#######|
|
|
|
|
// ---------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b16(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
m := size / 2
|
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, 0,
|
|
|
|
size, m,
|
|
|
|
0, m,
|
|
|
|
m, 0,
|
|
|
|
})
|
|
|
|
|
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
m, m,
|
|
|
|
size, size,
|
|
|
|
0, size,
|
|
|
|
m, m,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// b17
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |##### |
|
|
|
|
// |### |
|
|
|
|
// |# |
|
|
|
|
// | ##|
|
|
|
|
// | ##|
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b17(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |##### |
|
|
|
|
// |#### |
|
|
|
|
// |### |
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b18(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
m := size / 2
|
|
|
|
|
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
0, 0,
|
|
|
|
m, 0,
|
|
|
|
0, size,
|
|
|
|
0, 0,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// b19
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |########|
|
|
|
|
// |### ###|
|
|
|
|
// |# #|
|
|
|
|
// |### ###|
|
|
|
|
// |########|
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b19(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | ## |
|
|
|
|
// |### |
|
|
|
|
// |## |
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b20(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
m := size / 2
|
|
|
|
q := size / 4
|
|
|
|
|
|
|
|
drawBlock(img, x, y, size, angle, []int{
|
|
|
|
q, 0,
|
|
|
|
0, size,
|
|
|
|
0, m,
|
|
|
|
q, 0,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// b21
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | #### |
|
|
|
|
// |## #####|
|
|
|
|
// |## ##|
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b21(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | #### |
|
|
|
|
// |## ### |
|
|
|
|
// |## ##|
|
|
|
|
// |## ##|
|
|
|
|
// |# #|
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b22(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | #######|
|
|
|
|
// |### #|
|
|
|
|
// |## |
|
|
|
|
// |## |
|
|
|
|
// |# |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b23(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// | ## ###|
|
|
|
|
// |### ###|
|
|
|
|
// |## ## |
|
|
|
|
// |## ## |
|
|
|
|
// |# # |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b24(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |# #|
|
|
|
|
// |## ###|
|
|
|
|
// |## ## |
|
|
|
|
// |###### |
|
|
|
|
// |#### |
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b25(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |# #|
|
|
|
|
// |### ###|
|
|
|
|
// | #### |
|
|
|
|
// |### ###|
|
|
|
|
// |# #|
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b26(img *image.Paletted, x, y, size, angle int) {
|
2021-04-23 05:38:53 +05:30
|
|
|
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
|
|
|
|
//
|
|
|
|
// ----------
|
|
|
|
// |########|
|
|
|
|
// |## ###|
|
|
|
|
// |# #|
|
|
|
|
// |### ##|
|
|
|
|
// |########|
|
|
|
|
// ----------
|
2021-12-20 10:11:31 +05:30
|
|
|
func b27(img *image.Paletted, x, y, size, angle int) {
|
2016-11-04 03:46:01 +05:30
|
|
|
m := size / 2
|
2021-04-23 05:38:53 +05:30
|
|
|
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,
|
|
|
|
})
|
2016-11-04 03:46:01 +05:30
|
|
|
}
|