#include #include #include #include #include #include #include static Picture createPicture(Display *display) { Pixmap pixmap; XRenderPictFormat *fmt; XRenderPictureAttributes pict_attr; XRenderColor red = { .red = 0xffff, .alpha = 0xffff }; Picture picture; fmt = XRenderFindStandardFormat(display, PictStandardRGB24); pixmap = XCreatePixmap(display, DefaultRootWindow(display), 128, 128, fmt->depth); pict_attr.repeat=RepeatNone; picture = XRenderCreatePicture(display, pixmap, fmt, CPRepeat, &pict_attr); XFreePixmap(display, pixmap); XRenderFillRectangle (display, PictOpSrc, picture, &red, 0, 0, 128, 128); return picture; } int main(int argc, char *argv[]) { Display *display; Visual *visual; Window window; Picture source, picture; XRenderPictFormat *fmt; XRectangle clip; XRenderColor color_white = {.red=0xffff, .green=0xffff, .blue=0xffff, .alpha=0xffff}; int render_event_base, render_error_base; display = XOpenDisplay(NULL); if (!XRenderQueryExtension(display, &render_event_base, &render_error_base)) { fprintf(stderr, "RENDER extension missing!\n"); abort(); } visual = DefaultVisual (display, DefaultScreen (display)); fmt = XRenderFindVisualFormat (display, visual); window = XCreateWindow (display, DefaultRootWindow (display), 0, 0, 640, 480, 0, fmt->depth, InputOutput, visual, 0, NULL); XMapWindow (display, window); picture = XRenderCreatePicture(display, window, fmt, 0, NULL); XSelectInput(display, window, KeyPressMask|KeyReleaseMask|ExposureMask |ButtonPressMask|StructureNotifyMask); /* now make the window visible */ XMapWindow(display, window); source = createPicture(display); XRenderSetPictureFilter(display, source, "fast", NULL, 0); fmt = XRenderFindStandardFormat(display, PictStandardA8); //Shear XTransform xf; xf.matrix[0][0] = XDoubleToFixed(1); xf.matrix[0][1] = XDoubleToFixed(0.5); xf.matrix[0][2] = 0; xf.matrix[1][0] = XDoubleToFixed(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, source, &xf); while(1) { XEvent event; XNextEvent(display, &event); switch(event.type) { case Expose: XRenderFillRectangle(display, PictOpOver, picture, &color_white, 0, 0, 1000, 1000); XRenderComposite (display, PictOpOver, source, None, picture, -100, -100, 0, 0, 0, 0, 500, 500); break; case DestroyNotify: return 0; } } return 0; }