ryochack
1/9/2012 - 4:08 AM

"A Tour of Go" http://tour.golang.org/#46

/*
 * 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)
}