package main

import "gobject/cairo-1.0"

func main() {
	surface := cairo.NewImageSurface(cairo.FormatARGB32, 120, 120)
	cr := cairo.NewContext(surface)

	// Examples are in 1.0 x 1.0 coordinate space
	cr.Scale(120, 120)

	// Drawing code goes here
	cr.SetSourceRGB(0, 0, 0)
	cr.MoveTo(0, 0)
	cr.LineTo(1, 1)
	cr.MoveTo(1, 0)
	cr.LineTo(0, 1)
	cr.SetLineWidth(0.2)
	cr.Stroke()

	cr.Rectangle(0, 0, 0.5, 0.5)
	cr.SetSourceRGBA(1, 0, 0, 0.8)
	cr.Fill()

	cr.Rectangle(0, 0.5, 0.5, 0.5)
	cr.SetSourceRGBA(0, 1, 0, 0.6)
	cr.Fill()

	cr.Rectangle(0.5, 0, 0.5, 0.5)
	cr.SetSourceRGBA(0, 0, 1, 0.4)
	cr.Fill()

	// Write output
	surface.WriteToPNG("setsourcergba.png")
}