Skip to content

Instantly share code, notes, and snippets.

@jbranchaud
Created November 12, 2017 16:58
Show Gist options
  • Save jbranchaud/d2e09481a242401f5904aeb452e01a3d to your computer and use it in GitHub Desktop.
Save jbranchaud/d2e09481a242401f5904aeb452e01a3d to your computer and use it in GitHub Desktop.
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
var picArray [][]uint8
picArray = make([][]uint8, 0, dy)
for i := 0; i < dy; i++ {
var currX []uint8
currX = make([]uint8, 0, dx)
for j := 0; j < dx; j++ {
currX = append(currX, uint8((i+j)/2))
}
picArray = append(picArray, currX)
}
return picArray
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment