To set the clip-origin of a given GC, use XSetClipOrigin().
To set the clip-mask of a given GC to the specified pixmap, use XSetClipMask().
To set the clip-mask of a given GC to the specified list of rectangles, use XSetClipRectangles().
Xlib provides a set of basic functions for performing region arithmetic. For information about these functions, see "Manipulating Regions".