-
Notifications
You must be signed in to change notification settings - Fork 2
/
logo.go
67 lines (54 loc) · 1.54 KB
/
logo.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package rendercard
import (
"image"
"github.com/FloatTech/gg"
)
// RenderServerListLogo ...
func RenderServerListLogo(fontdata []byte) (img image.Image, err error) {
const w, h = 400, 200
canvas := gg.NewContext(w, h)
canvas.SetRGBA255(187, 122, 132, 255)
err = canvas.ParseFontFace(fontdata, 72)
if err != nil {
return
}
canvas.DrawStringAnchored("Server", 22, 45, 0, 1)
canvas.SetRGBA255(246, 166, 171, 255)
canvas.DrawStringAnchored("List", 219, 112, 0, 1)
canvas.SetRGBA255(135, 145, 173, 255)
err = canvas.ParseFontFace(fontdata, 48)
if err != nil {
return
}
canvas.DrawStringAnchored("服務列表", 23, 120, 0, 1)
canvas.SetRGBA255(103, 178, 240, 255)
err = canvas.ParseFontFace(fontdata, 36)
if err != nil {
return
}
canvas.DrawStringAnchored("サーバー", 82, 25, 0, 1)
canvas.DrawStringAnchored("リスト", 280, 83, 0, 1)
mask := canvas.AsMask()
stroked := gg.NewContext(w, h)
err = stroked.SetMask(mask)
if err != nil {
return
}
stroked.SetRGBA255(255, 255, 255, 255)
stroked.DrawRectangle(0, 0, float64(stroked.W()), float64(stroked.H()))
stroked.Fill()
strokedimg := stroked.Image()
coloredimg := canvas.Image()
canvas = gg.NewContext(w, h)
canvas.DrawImage(strokedimg, -3, 0)
canvas.DrawImage(strokedimg, 3, 0)
canvas.DrawImage(strokedimg, 0, -3)
canvas.DrawImage(strokedimg, 0, 3)
canvas.DrawImage(strokedimg, -3, -3)
canvas.DrawImage(strokedimg, 3, 3)
canvas.DrawImage(strokedimg, 3, -3)
canvas.DrawImage(strokedimg, -3, 3)
canvas.DrawImage(coloredimg, 0, 0)
img = canvas.Image()
return
}