allocimage.c (518B)
1 /* Copyright ©2007-2010 Kris Maglione <maglione.k at Gmail> 2 * See LICENSE file for license details. 3 */ 4 #include "../x11.h" 5 6 Image* 7 allocimage(int w, int h, int depth) { 8 Image *img; 9 10 img = emallocz(sizeof *img); 11 img->type = WImage; 12 img->xid = XCreatePixmap(display, scr.root.xid, w, h, depth); 13 img->gc = XCreateGC(display, img->xid, 0, nil); 14 img->colormap = scr.colormap; 15 img->visual = scr.visual; 16 if(depth == 32) 17 img->visual = scr.visual32; 18 img->depth = depth; 19 img->r = Rect(0, 0, w, h); 20 return img; 21 }