Golang's color.RGBA seems to produce some odd artifacts.
Last active
July 27, 2017 18:01
-
-
Save mmcloughlin/e824139574762169ce7f232fd76da9df 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 ( | |
| "image/color" | |
| "math/rand" | |
| "github.com/mmcloughlin/globe" | |
| ) | |
| func Draw(c color.Color, filename string) error { | |
| lat, lng := 51.453349, -2.588323 | |
| g := globe.New() | |
| g.DrawGraticule(10.0) | |
| for i := 0; i < 1000; i++ { | |
| plat := lat + 20.0*(rand.Float64()-0.5) | |
| plng := lng + 20.0*(rand.Float64()-0.5) | |
| g.DrawDot(plat, plng, 0.1, globe.Color(c)) | |
| } | |
| g.CenterOn(lat, lng) | |
| return g.SavePNG(filename, 400) | |
| } | |
| func main() { | |
| Draw(color.NRGBA{255, 0, 0, 128}, "nrgba.png") | |
| Draw(color.RGBA{255, 0, 0, 128}, "rgba.png") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

