-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathresize_test.go
55 lines (50 loc) · 2.13 KB
/
resize_test.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
package gfx
import "image"
func ExampleNewScaledImage() {
src := NewTile(Palette1Bit, 8, []uint8{
1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 0, 0, 1, 1, 0, 0, 1,
1, 0, 1, 1, 1, 1, 0, 1,
1, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1,
})
dst := NewScaledImage(src, 2.0)
func(images ...image.Image) {
for _, m := range images {
for y := 0; y < m.Bounds().Dy(); y++ {
for x := 0; x < m.Bounds().Dx(); x++ {
if r, _, _, _ := m.At(x, y).RGBA(); r == 0 {
Printf("▓▓")
} else {
Printf("░░")
}
}
Printf("\n")
}
Printf("\n")
}
}(src, dst)
// Output:
//
// ░░░░░░░░░░░░░░░░
// ░░▓▓▓▓▓▓▓▓▓▓▓▓░░
// ░░▓▓▓▓░░░░▓▓▓▓░░
// ░░▓▓░░░░░░░░▓▓░░
// ░░▓▓▓▓▓▓▓▓▓▓▓▓░░
// ░░░░░░░░░░░░░░░░
//
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░
// ░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░
// ░░░░▓▓▓▓▓▓▓▓░░░░░░░░▓▓▓▓▓▓▓▓░░░░
// ░░░░▓▓▓▓▓▓▓▓░░░░░░░░▓▓▓▓▓▓▓▓░░░░
// ░░░░▓▓▓▓░░░░░░░░░░░░░░░░▓▓▓▓░░░░
// ░░░░▓▓▓▓░░░░░░░░░░░░░░░░▓▓▓▓░░░░
// ░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░
// ░░░░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
//
}