Skip to content

Instantly share code, notes, and snippets.

@mewmew
Created November 17, 2014 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mewmew/cb3f8dfeb9246326d58d to your computer and use it in GitHub Desktop.
Save mewmew/cb3f8dfeb9246326d58d to your computer and use it in GitHub Desktop.
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)
}
}
@mewmew
Copy link
Author

mewmew commented Nov 17, 2014

Screenshot - fractal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment