File:  [Research Unix] / researchv9 / X11 / src / X.V11R1 / demos / wm / mkPixmap.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:22:00 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv9-SUN3_old, researchv9-SUN3, HEAD
researchv9-SUN3(old)

/* 
 * $Locker:  $ 
 */ 
static char     *rcsid = "$Header: /var/lib/cvsd/repos/research/researchv9/X11/src/X.V11R1/demos/wm/mkPixmap.c,v 1.1.1.1 2018/04/24 17:22:00 root Exp $";
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "test.h"

extern Display *dpy;
extern RootInfoRec *findRootInfo();

Pixmap 
MakePixmap(root, data, width, height) Drawable root; short *data; int width, height;
{
    XImage ximage;
    GC pgc;
    XGCValues gcv;
    Pixmap pid;
    int scr = findRootInfo(root) - RootInfo;

    pid = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, scr));

    gcv.foreground = BlackPixel(dpy, scr);
    gcv.background = WhitePixel(dpy, scr);
    pgc = XCreateGC(dpy, pid, GCForeground | GCBackground, &gcv);
    pid = XCreatePixmap(dpy, root, width, height, DefaultDepth(dpy, scr));

    ximage.height = height;
    ximage.width = width;
    ximage.xoffset = 0;
    ximage.format = XYBitmap;
    ximage.data = (char *)data;
    ximage.byte_order = LSBFirst;
    ximage.bitmap_unit = 16;
    ximage.bitmap_bit_order = LSBFirst;
    ximage.bitmap_pad = 16;
    ximage.bytes_per_line = (width+15)/16 * 2;
    ximage.depth = 1;

    XPutImage(dpy, pid, pgc, &ximage,0, 0,  0, 0, width, height);
    XFreeGC(dpy, pgc);
    return(pid);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.