Skip to content

Instantly share code, notes, and snippets.

@mmcloughlin
Last active July 27, 2017 18:01
Show Gist options
  • Select an option

  • Save mmcloughlin/e824139574762169ce7f232fd76da9df to your computer and use it in GitHub Desktop.

Select an option

Save mmcloughlin/e824139574762169ce7f232fd76da9df to your computer and use it in GitHub Desktop.
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")
}

Golang's color.RGBA seems to produce some odd artifacts.

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