vx11 / render / bridge.h
18 lines · 18 sloc · 778 bytes · c4bc47d81a04ec4c69336c7c85575735cb003365
Raw
1#ifndef VX11_RENDER_BRIDGE_H
2#define VX11_RENDER_BRIDGE_H
3#include <X11/Xlib.h>
4#include <X11/extensions/Xrender.h>
5/* Snapshot before mapping; dim without requiring a compositor. */
6static Pixmap vx11_render_backdrop(Display *d, int x, int y, int w, int h) {
7 Pixmap p = XCreatePixmap(d, DefaultRootWindow(d), w, h, DefaultDepth(d, DefaultScreen(d)));
8 GC gc = XCreateGC(d, p, 0, NULL);
9 XCopyArea(d, DefaultRootWindow(d), p, gc, x, y, w, h, 0, 0);
10 XFreeGC(d, gc);
11 XRenderPictFormat *f = XRenderFindVisualFormat(d, DefaultVisual(d, DefaultScreen(d)));
12 Picture dst = XRenderCreatePicture(d, p, f, 0, NULL);
13 XRenderColor shade = {0x1000, 0x1500, 0x2100, 0xd800};
14 XRenderFillRectangle(d, PictOpOver, dst, &shade, 0, 0, w, h);
15 XRenderFreePicture(d, dst);
16 return p;
17}
18#endif
19