Skip to content

Instantly share code, notes, and snippets.

@TonPC64
Created January 5, 2019 07:13
Show Gist options
  • Save TonPC64/ce9d365452713e59c729b11998c88f67 to your computer and use it in GitHub Desktop.
Save TonPC64/ce9d365452713e59c729b11998c88f67 to your computer and use it in GitHub Desktop.
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
slice := make([][]uint8, dx, dx)
// loop dx
for x := 0; x < dx; x++ {
slice[x] = make([]uint8, dy, dy)
// loop dy
for y := 0; y < dy; y++ {
// set value in pixel
slice[x][y] = uint8(x^y)
}
}
return slice
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment