|
|
1.1 ! root 1: #include <jerq.h> ! 2: ! 3: Bitmap ! 4: ToBitmap(bits, bytewidth, ox, oy, cx, cy) ! 5: char *bits; ! 6: { ! 7: Bitmap *bm; ! 8: int dx, dy; ! 9: #ifdef X11 ! 10: XImage *im; ! 11: #endif X11 ! 12: #ifdef SUNTOOLS ! 13: int i, lbytes; ! 14: char *to; ! 15: #endif SUNTOOLS ! 16: ! 17: dx = cx - ox; ! 18: dy = cy - oy; ! 19: bm = balloc(Rect(ox, oy, cx, cy)); ! 20: #ifdef X11 ! 21: im = XCreateImage(dpy, XDefaultVisual(dpy, 0), 1, ! 22: XYBitmap, 0, bits, dx, dy, 8, bytewidth); ! 23: XSetForeground(dpy, gc, fgpix); ! 24: XSetBackground(dpy, gc, bgpix); ! 25: XSetFunction(dpy, gc, GXcopy); ! 26: XPutImage(dpy, bm->dr, gc, im, 0, 0, 0, 0, dx, dy); ! 27: im->data = (char *)0; ! 28: XDestroyImage(im); ! 29: #endif X11 ! 30: #ifdef SUNTOOLS ! 31: lbytes = mpr_d((Pixrect *)bm->dr)->md_linebytes; ! 32: to = (char *)mpr_d((Pixrect *)bm->dr)->md_image; ! 33: for(i = 0; i < dy; i++) { ! 34: bcopy(bits, to,lbytes); ! 35: to += lbytes; ! 36: bits += bytewidth; ! 37: } ! 38: #endif SUNTOOLS ! 39: return *bm; ! 40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.