Cairo.Pattern Class
Patterns allow you to tile or extend images and objects and allow you to draw things like gradients.

See Also: Pattern Members

Syntax

public class Pattern : IDisposable

Remarks

C# Example

/* example assumes the Graphics object has already been set up  and width and height are initialized*/

        static void draw (Cairo.Graphics gr, int width, int height)
        {
                int w, h;
                ImageSurface image;
                Matrix matrix;
                Pattern pattern;

                gr.Scale (width, height);
                gr.LineWidth = 0.04;

                image = new ImageSurface ("data/e.png");
                w = image.Width;
                h = image.Height;

                pattern = new Pattern (image);
                pattern.Extend = Cairo.Extend.Repeat;

                gr.Translate (0.5, 0.5);
                gr.Rotate (Math.PI / 4);
                gr.Scale (1 / Math.Sqrt (2), 1 / Math.Sqrt (2));
                gr.Translate (- 0.5, - 0.5);

                matrix = new Matrix ();
                matrix.InitScale (w * 5.0, h * 5.0);

                pattern.Matrix = matrix;

                gr.Pattern = pattern;

                gr.Rectangle ( new PointD (0, 0),
                               1.0, 1.0);
                gr.Fill ();

                pattern.Destroy ();
                image.Destroy();
        }
  

Requirements

Namespace: Cairo
Assembly: Mono.Cairo (in Mono.Cairo.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0