Created
January 5, 2019 07:13
-
-
Save TonPC64/ce9d365452713e59c729b11998c88f67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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