gg
Resmi Depo: fogleman/gg: Go Graphics - 2D rendering in Go with a simple API. (github.com)
Resmi Dokümantasyon: gg package - github.com/fogleman/gg - Go Packages
Resmi Örnekler: gg/examples at master · fogleman/gg (github.com)
gg köklü bir 2D grafik render motorudur. Görüntü oluşturma için uygundur.
Kurulum
go get -u github.com/fogleman/ggHızlı Başlangıç
go
package main
import "github.com/fogleman/gg"
func main() {
dc := gg.NewContext(1000, 1000) // Tuval oluştur. Yükseklik 1000 genişlik 1000
dc.DrawCircle(500, 500, 400) // (500,500) koordinatlarında 400 yarıçapında daire çiz
dc.SetRGB(0, 0, 0) // Rengi siyah olarak ayarla
dc.Fill() // Doldur
dc.SavePNG("out.png") // Görüntü dosyası olarak kaydet
}Noktalar

go
func TestDot(t *testing.T) {
dc := gg.NewContext(1000, 1000)
dc.SetRGB(0, 0, 0)
for i := 1; i < 10; i++ {
dc.DrawPoint(float64(50*i), float64(50*i), 5) // Nokta koordinatlarını ve yarıçapını ayarla
}
dc.Fill() // Doldur
dc.SavePNG("out.png")
}Çizgiler

go
func TestLines(t *testing.T) {
dc := gg.NewContext(1000, 1000)
dc.SetRGB(0, 0, 0)
dc.SetLineWidth(5) // Çizgi genişliğini ayarla
dc.DrawLine(1000, 0, 0, 1000)
dc.DrawLine(1000, 1000, 0, 0)
dc.Stroke() // Çizgileri çiz
dc.SavePNG("lines.png")
}