Skip to content

Instantly share code, notes, and snippets.

@zainfathoni
Created April 10, 2017 03:54
Show Gist options
  • Save zainfathoni/e72d5c5cb104d54c5a766ba71b4b04bc to your computer and use it in GitHub Desktop.
Save zainfathoni/e72d5c5cb104d54c5a766ba71b4b04bc to your computer and use it in GitHub Desktop.
package main
import "golang.org/x/tour/pic"
func imageFunc(x, y int) uint8 {
return uint8(x) ^ uint8(y)
}
func Pic(dx, dy int) (image [][]uint8) {
image = make([][]uint8, dy)
for i:= range image {
image[i] = make([]uint8, dx)
for j:= range image[i] {
image[i][j] = imageFunc(i, j)
}
}
return
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment