Created
November 17, 2014 01:22
-
-
Save mewmew/cb3f8dfeb9246326d58d 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 ( | |
"image" | |
"image/color" | |
"log" | |
"github.com/mewkiz/pkg/imgutil" | |
) | |
const ( | |
width, height = 256, 256 | |
) | |
func main() { | |
dst := image.NewRGBA(image.Rect(0, 0, width, height)) | |
for x := 0; x < width; x++ { | |
for y := 0; y < height; y++ { | |
r := uint8(x - y) | |
b := uint8((x - y) ^ (x + y)) | |
c := color.RGBA{r, 0, b, 255} | |
dst.Set(x, y, c) | |
} | |
} | |
err := imgutil.WriteFile("fractal.png", dst) | |
if err != nil { | |
log.Fatalln(err) | |
} | |
} |
Author
mewmew
commented
Nov 17, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment