[Mono-list] Clipping with Cairo

Francisco M. Marzoa fmmarzoa at gmx.net
Wed Nov 17 10:45:58 EST 2010


Hello again,

I want to draw something in a Cairo surface but when Stroking, just
paint the things that are within a given rectangle.

I think I understand the theory: draw things into the source, then
create a rectangle for clipping into the mask, and finally stroke it to
the destination.

The problem is that I do not know how to draw within the path, so I
cannot create that rectangle before stroking.

For example:

        cc = Gdk.CairoHelper.Create (drawingarea1.GdkWindow);
        cc.Color = new Cairo.Color (0,0,0);
        cc.MoveTo (10,10);
        cc.LineTo (100, 100);
        cc.Rectangle (50,50,80,80);
        cc.Stroke();

In this code the Rectangle which I want to use to cut the line, is drawn
also on source surface, not on mask as path. The concrete question is
then, how I can draw that rectangle as a path to clip the line?

Thanks a lot in advance,




More information about the Mono-list mailing list