#include #include #include #include #include #include #include Display *display; int screen; Window root, window; XEvent event; Pixmap maskPixmap; Picture sourcePicture; Picture createPicture() { XLinearGradient linearGradient; XFixed stops[2]; XRenderColor colors[2]; linearGradient.p1.x = 29053656; linearGradient.p1.y = 15875466; linearGradient.p2.x = 1336988; linearGradient.p2.y = 3230600; stops[0] = 0; stops[1] = 65536; colors[0].red = 0xffff; colors[0].green = 255; colors[0].blue = 255; colors[0].alpha = 0xffff; colors[1].red = 255; colors[1].green = 27647; colors[1].blue = 0xffff; colors[1].alpha = 0xffff; Picture picture = XRenderCreateLinearGradient (display, &linearGradient, stops, colors, 2); XRenderPictureAttributes pict_attr; pict_attr.repeat=RepeatReflect; XRenderChangePicture (display, picture, CPRepeat, &pict_attr); return picture; } int main(int argc, char *argv[]) { /*Bosing initialization stuff*/ display=XOpenDisplay(NULL); int render_event_base, render_error_base; int render_present=XRenderQueryExtension(display, &render_event_base, &render_error_base); if (!render_present) { fprintf(stderr, "RENDER extension missing!\n"); abort(); } XRenderPictFormat *fmt=XRenderFindStandardFormat(display, PictStandardRGB24); screen=DefaultScreen(display); root=DefaultRootWindow(display); window = XCreateWindow(display, root, 0, 0, 640, 480, 0, DefaultDepth(display, screen), InputOutput, DefaultVisual(display, screen), 0, NULL); XRenderPictureAttributes pict_attr; pict_attr.poly_edge=PolyEdgeSmooth; pict_attr.poly_mode=PolyModeImprecise; Picture picture=XRenderCreatePicture(display, window, fmt, CPPolyEdge|CPPolyMode, &pict_attr); XSelectInput(display, window, KeyPressMask|KeyReleaseMask|ExposureMask |ButtonPressMask|StructureNotifyMask); XMapWindow(display, window); sourcePicture = createPicture(); while(1) { XNextEvent(display, &event); switch(event.type) { case Expose: XRenderComposite (display, PictOpOver, sourcePicture, None, picture, 0, 0, 0, 0, 0, 0, 1000, 1000); break; case DestroyNotify: return 0; } } return 0; }