#include #include #include #include #include #include #include Display *display; int screen; Window root, window; XEvent event; Pixmap maskPixmap; Picture sourcePicture; Picture createPicture() { XRenderPictFormat *fmt = XRenderFindStandardFormat(display, PictStandardRGB24); maskPixmap = XCreatePixmap(display, window, 10, 1, 24); XRenderPictureAttributes pict_attr; pict_attr.repeat=RepeatNone; Picture picture = XRenderCreatePicture(display, maskPixmap, fmt, CPRepeat, &pict_attr); XRenderColor yellow={.red=0xffff, .green=0xffff, .blue=0, .alpha=0xffff}; XRenderFillRectangle (display, PictOpSrc, picture, &yellow, 0, 0, 1000, 1000); 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); /* now make the window visible */ XMapWindow(display, window); XRenderColor color_white = {.red=0xffff, .green=0xffff, .blue=0xffff, .alpha=0xffff}; sourcePicture = createPicture(); XRenderSetPictureFilter(display, sourcePicture, "good", NULL, 0); XTransform xf; xf.matrix[0][0] = XDoubleToFixed(0.2); xf.matrix[0][1] = 0; xf.matrix[0][2] = 0; xf.matrix[1][0] = 0; xf.matrix[1][1] = XDoubleToFixed(1); xf.matrix[1][2] = 0; xf.matrix[2][0] = 0; xf.matrix[2][1] = 0; xf.matrix[2][2] = 1<<16; XRenderSetPictureTransform (display, sourcePicture, &xf); while(1) { XNextEvent(display, &event); switch(event.type) { case Expose: { XRenderFillRectangle(display, PictOpOver, picture, &color_white, 0, 0, 1000, 1000); XRenderComposite (display, PictOpOver, sourcePicture, None, picture, -50, -50, 0, 0, 10, 10, 500, 500); break; case DestroyNotify: return 0; } } } return 0; }