Skip to content

Instantly share code, notes, and snippets.

@alexbosworth
Created October 29, 2016 00:46
Show Gist options
  • Save alexbosworth/19f2d8d7fe613f0a272b58a7c17e0af6 to your computer and use it in GitHub Desktop.
Save alexbosworth/19f2d8d7fe613f0a272b58a7c17e0af6 to your computer and use it in GitHub Desktop.
package main
import (
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
// Create pixels
pixels := make([][]uint8, dy)
for x := 0; x < dx; x++ {
pixels[x] = make([]uint8, dy)
for y := 0; y < dy; y++ {
pixels[x][y] = uint8(x ^ y)
}
}
return pixels
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment