Path: utzoo!attcan!uunet!lll-winken!xanth!nic.MR.NET!csd4.milw.wisc.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!SPAM.ISTC.SRI.COM!jw From: jw@SPAM.ISTC.SRI.COM (Julie Wong) Newsgroups: comp.windows.x Subject: X question Message-ID: <8902080204.AA04728@aalps5> Date: 8 Feb 89 02:04:22 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: The Internet Lines: 69 Hello, I have been trying to put up a black and white bit map on an X window and without any luck. Could someone help? I declared an XImage structure of size 16x16. Set the image data pointer to an array of bits. Then used the XPutImage command to put up the image. So far I have not been getting anything. I think my graphics context is declared correctly because I am able to put up rectangles and text using the XDrawRectangle and XDrawString commands. The workstation I use is a Sun 140. Thanks, Julie ------------------------------- Segments of the program follows: -------------------------------- static short icon_bitmap_bits[256]={ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x18, 0x30, 0x08, 0x60, 0x0c, 0x80, 0x07, 0x00, 0x03, 0x80, 0x07, 0xc0, 0x0c, 0x60, 0x18, 0x30, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /*create default graphic context for the window*/ values.function = GXxor; values.plane_mask = AllPlanes; values.foreground = BlackPixel(dpy,screen); values.background = WhitePixel(dpy,screen); values.graphics_exposures = 0; mask = 0; mask |= GCFunction; mask |= GCPlaneMask; mask |= GCForeground; mask |= GCBackground; mask |= GCGraphicsExposures; gc = XCreateGC(dpy,window,mask,&values); /*define the type of image data*/ icon_image.width = 16; icon_image.height = 16; icon_image.xoffset = 0; icon_image.format = XYBitmap; icon_image.data = (char *) icon_bitmap_bits; icon_image.byte_order = LSBFirst; icon_image.bitmap_unit = 8; icon_image.bitmap_bit_order = LSBFirst; icon_image.bitmap_pad = 0; icon_image.depth = 1; icon_image.bytes_per_line = 2; icon_image.bits_per_pixel = 1; /*put up image on window*/ XPutImage(dpy, (Drawable) window, gc, &icon_image, 0,0, 0,0, 16,16);