See Also: Pattern Members
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();
}