Created
April 10, 2017 03:54
-
-
Save zainfathoni/e72d5c5cb104d54c5a766ba71b4b04bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 imageFunc(x, y int) uint8 { | |
return uint8(x) ^ uint8(y) | |
} | |
func Pic(dx, dy int) (image [][]uint8) { | |
image = make([][]uint8, dy) | |
for i:= range image { | |
image[i] = make([]uint8, dx) | |
for j:= range image[i] { | |
image[i][j] = imageFunc(i, j) | |
} | |
} | |
return | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment