2012-01-27 37 views

回答

1

你可以做到這一點使用XSetClipRectangles()參考hereXSetClipMask()參考here

所以:

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

+0

您不恢復GC,你只是刪除剪貼畫。原來無法通過XGetGCValues()檢索GC的剪貼畫。不管怎麼說,還是要謝謝你。 – knarf 2012-01-31 20:15:22