1
0
gotour-notes/genimage/go.go

27 lines
439 B
Go
Raw Normal View History

2012-08-01 08:13:46 -07:00
package main
import (
"learning/pic"
"flag"
)
func Pic(dx, dy int) [][]uint8 {
result := make([][]uint8, dy)
var ii, jj uint8
2012-08-02 14:04:07 -07:00
for j := 0; j < dy; j++ {
result[j] = make([]uint8, dx)
for i := 0; i < dx; i++ {
2012-08-01 08:13:46 -07:00
ii = uint8(i)
jj = uint8(j)
2012-08-02 14:04:07 -07:00
result[j][i] = ii ^ jj
2012-08-01 08:13:46 -07:00
}
}
return result
}
func main() {
flag.Parse()
image := pic.CalculateImage(Pic)
pic.SaveImage(flag.Arg(0), image)
}