Skip to content

Instantly share code, notes, and snippets.

@ryanfrance
Created May 23, 2024 16:29
Show Gist options
  • Save ryanfrance/f333abd6bde8d1d5741b588e1d7443fc to your computer and use it in GitHub Desktop.
Save ryanfrance/f333abd6bde8d1d5741b588e1d7443fc to your computer and use it in GitHub Desktop.
Integer interpretation for bluescale picture
package main
import (
"golang.org/x/tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
picture := make([][]uint8, dy)
for y := 0; y < dy; y++ {
row := make([]uint8, dx)
for x := 0; x < dx; x++ {
row[x] = uint8((x+y) / 2)
}
picture[y] = row
}
return picture
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment