gg/examples/example0.go

21 lines
369 B
Go
Raw Normal View History

2016-02-18 22:02:57 +01:00
package main
2016-02-19 15:43:37 +01:00
import "github.com/fogleman/gg"
2016-02-18 22:02:57 +01:00
func main() {
2016-02-19 15:43:37 +01:00
dc := gg.NewContext(256, 256)
2016-02-19 17:07:25 +01:00
dc.SetRGBA(1, 0, 0, 0.3)
dc.Clear()
2016-02-18 22:02:57 +01:00
dc.MoveTo(20, 20)
dc.LineTo(236, 236)
dc.LineTo(236, 128)
dc.LineTo(20, 128)
dc.QuadraticTo(0, 64, 120, 20)
2016-02-19 17:07:25 +01:00
dc.SetRGBA(1, 0, 0, 0.8)
2016-02-18 22:02:57 +01:00
dc.FillPreserve()
2016-02-19 17:07:25 +01:00
dc.SetRGB(0, 0, 0)
2016-02-18 22:02:57 +01:00
dc.SetLineWidth(8)
dc.Stroke()
dc.WriteToPNG("out.png")
}