Skip to content

Instantly share code, notes, and snippets.

@ryochack
Created January 9, 2012 04:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryochack/1581013 to your computer and use it in GitHub Desktop.
Save ryochack/1581013 to your computer and use it in GitHub Desktop.
/*
* http://tour.golang.org/#46
* OR
* http://http://go-tour-jp.appspot.com/#45
*/
package main
import "tour/pic"
func Pic(dx, dy int) [][]uint8 {
img := make([][]uint8, dy)
for y:=0; y<dy; y++ {
img[y] = make([]uint8, dx)
}
for y:=0; y<dy; y++ {
for x:=0; x<dx; x++ {
img[y][x] = (uint8)(x*y)%255
}
}
return img
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment