using Cairo; ... Context cr = new Context(surface); cr.SetSourceRGB(0, 0, 0); cr.LineWidth = 2.0; cr.MoveTo(50, 50); cr.LineTo(100, 100); cr.Stroke();
using Cairo; ... Context cr = new Context(surface); cr.SetSourceRGB(1, 0, 0); cr.LineWidth = 4.0; cr.MoveTo(0, 0); cr.LineTo(50, 50); cr.LineTo(100, 0); cr.Stroke();This code creates a Cairo context and sets the source color to red, sets the line width to 4.0, and moves to position (0, 0) using the MoveTo function. The LineTo function is then used twice to draw a triangle shape on the context, and Stroke is used to draw the triangle. The package library for the Cairo Context LineTo function is the Cairo Graphics Library, which is available for C#, Python, and other programming languages.