using Cairo; using (var surface = new ImageSurface(Format.ARGB32, 200, 200)) using (var cr = new Context(surface)) { cr.NewPath(); cr.LineTo(50, 50); cr.LineTo(50, 100); cr.LineTo(100, 100); cr.LineTo(100, 50); cr.ClosePath(); cr.SetSourceRGB(0, 0, 1); cr.Fill(); }
using Cairo; var surface = new ImageSurface(Format.ARGB32, 200, 200); var cr = new Context(surface); cr.NewPath(); cr.Rectangle(50, 50, 100, 100); cr.SetSourceRGB(0, 0, 1); cr.Fill(); cr.Dispose(); surface.Dispose();This example creates a new path using Cairo.Context.NewPath(), draws a rectangle using Cairo.Context.Rectangle(), fills it with blue color using Cairo.Context.SetSourceRGB() and Cairo.Context.Fill(), and disposes of the cairo surface using Cairo.Context.Dispose(). The package library used in this example is Cairo.