[英]How can I limit the surface in which Xlib graphics primitives draw?
I think that's what clip are used for but I can't find any example to do this. 我认为这就是剪辑的用途,但我找不到任何示例可以做到这一点。 I need to:
我需要:
You can do it by using XSetClipRectangles()
referenced here and XSetClipMask()
referenced here 您可以通过做
XSetClipRectangles()
引用在这里和XSetClipMask()
引用在这里
So: 所以:
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
For further information type man functionName
in your terminal. 有关更多信息,请在终端中输入
man functionName
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.