Вы можете сделать это, используя XSetClipRectangles()
ссылка здесь и XSetClipMask()
ссылка здесь
Итак:
Display dpy; //This is your display, we'll assume it is a valid Display
GC gc; //This is your GC, we'll assume it is a valid GC
XRectangle recs[]; //This is an array containing the clipping regions you want.
int recs_n; //This is the number of rectangles in the 'recs' array.
XSetClipRectangles(dpy, gc, 0, 0, recs, recs_n, Unsorted); //Enable clipping
drawMyClippedGraphics(); //Call to whatever you want to use for drawing
XSetClipMask(dpy, gc, None); //Restore the GC
Для получения дополнительной информации введите man functionName
в своем терминале.