void main() { /* Load the image */ char[] filename = "/home/joe/plasma.png"; ubyte[] image; Info info = lodepng.png.decode32(image, cast(ubyte[])read(filename)); if (info.error != 0) throw new Exception("Error loading png " ~ filename ~ ", errorcode: " ~ toString(info.error)); if(image.length % 4 != 0) throw new Exception("Failcopter"); ubyte[] data; for(uint i; iroot, /* parent window */ 0, 0, /* x, y */ info.w, info.w, /* width, height */ 0, /* border_width */ XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */ screen->root_visual, /* visual */ XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK, /* masks */ [screen->black_pixel, XCB_EVENT_MASK_EXPOSURE]); xcb_map_window(conn, window); xcb_gcontext_t gc = xcb_generate_id(conn); xcb_create_gc(conn, gc, window, 0, null); /* Visual* vis = XDefaultVisualOfScreen(screen); XImage* im = XCreateImage(disp, vis, 24, ZPixmap, 0, data.ptr, info.w, info.h, 8, 0); data = null; XPutImage(disp, win, gc, im, 0, 0, 0, 0, info.w, info.h); */ xcb_flush(conn); xcb_generic_event_t *event; while(1) { event = xcb_wait_for_event(conn); if(event->type == XCB_EXPOSE) { xcb_put_image(conn, XCB_IMAGE_FORMAT_Z_PIXMAP, window, gc, info.w, info.h, /* width, height */ 0, 0, /* dst_x, dst_y */ 0, 24, /* left_pad, depth */ data.length, data.ptr); xcb_flush(conn); } } }