|
|
1.1 root 1: /*
2: * $Locker: $
3: */
4: static char *rcsid = "$Header: mkPixmap.c,v 1.2 87/06/17 16:20:05 swick Exp $";
5: #include <X11/Xlib.h>
6: #include <X11/Xutil.h>
7: #include "test.h"
8:
9: extern Display *dpy;
10: extern RootInfoRec *findRootInfo();
11:
12: Pixmap
13: MakePixmap(root, data, width, height) Drawable root; short *data; int width, height;
14: {
15: XImage ximage;
16: GC pgc;
17: XGCValues gcv;
18: Pixmap pid;
19: int scr = findRootInfo(root) - RootInfo;
20:
21: pid = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, scr));
22:
23: gcv.foreground = BlackPixel(dpy, scr);
24: gcv.background = WhitePixel(dpy, scr);
25: pgc = XCreateGC(dpy, pid, GCForeground | GCBackground, &gcv);
26: pid = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, scr));
27:
28: ximage.height = height;
29: ximage.width = width;
30: ximage.xoffset = 0;
31: ximage.format = XYBitmap;
32: ximage.data = (char *)data;
33: ximage.byte_order = LSBFirst;
34: ximage.bitmap_unit = 16;
35: ximage.bitmap_bit_order = LSBFirst;
36: ximage.bitmap_pad = 16;
37: ximage.bytes_per_line = (width+15)/16 * 2;
38: ximage.depth = 1;
39:
40: XPutImage(dpy, pid, pgc, &ximage,0, 0, 0, 0, width, height);
41: XFreeGC(dpy, pgc);
42: return(pid);
43: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.