Created
January 9, 2012 04:08
-
-
Save ryochack/1581013 to your computer and use it in GitHub Desktop.
"A Tour of Go" http://tour.golang.org/#46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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