Cairo is a 2D graphics library that supports multiple output targets. The FillPreserve function is used to fill the current path, but it leaves the path intact for further operations.
Here are some examples using the Cairo FillPreserve function:
Example 1: // create a new Cairo context using (var cr = new Cairo.Context(surface)) { // set the fill color to red cr.SetSourceRGB(1, 0, 0);
// draw a circle with a blue border cr.Arc(100, 100, 50, 0, 2 * Math.PI); cr.SetLineWidth(5); cr.SetSourceRGB(0, 0, 1); cr.StrokePreserve();
// fill the circle with red cr.FillPreserve();
// draw text inside the circle cr.SetFontSize(20); cr.SetSourceRGB(1, 1, 1); cr.MoveTo(75, 100); cr.ShowText("Hello, world!"); cr.Fill(); }
This example creates a new Cairo context and draws a circle with a blue border. The FillPreserve function is then used to fill the circle with red, leaving the path intact. Finally, text is drawn inside the circle.
Example 2: // create a new Cairo context using (var cr = new Cairo.Context(surface)) { // set the fill color to black cr.SetSourceRGB(0, 0, 0);
// define a path consisting of two rectangles cr.Rectangle(50, 50, 100, 100); cr.Rectangle(100, 100, 100, 100);
// fill the rectangles with black cr.FillPreserve();
// set the stroke color to white cr.SetSourceRGB(1, 1, 1);
// stroke the rectangles with a thick line cr.SetLineWidth(10); cr.Stroke(); }
This example creates a new Cairo context and defines a path consisting of two rectangles. The FillPreserve function is then used to fill the rectangles with black, leaving the path intact. Finally, the rectangles are stroked with a thick white line.
The package library for Cairo is called "cairosharp".
C# (CSharp) Cairo.FillPreserve - 30 examples found. These are the top rated real world C# (CSharp) examples of Cairo.FillPreserve extracted from open source projects. You can rate examples to help us improve the quality of examples.