Path: utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU Newsgroups: comp.windows.x Subject: Re: Pixmap conversion Message-ID: <9010261148.AA21461@Larry.McRCIM.McGill.EDU> Date: 26 Oct 90 11:48:42 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 44 > My program crashes on a Color display, because of the Pixmap used is > of depth 1. Is there any way that I can read a bitmapfile and > convert this into a Pixmap with depth > 1? From the Xlib document... To create a pixmap and then store bitmap-format data into it, use XCreatePixmapFromBitmapData. Pixmap XCreatePixmapFromBitmapData(display, d, data, width, height, fg, bg, depth) Display *display; Drawable d; char *data; unsigned int width, height; unsigned long fg, bg; unsigned int depth; display Specifies the connection to the X server. d Specifies the drawable that indicates the screen. data Specifies the data in bitmap format. width height Specify the width and height. fg bg Specify the foreground and background pixel values to use. depth Specifies the depth of the pixmap. The XCreatePixmapFromBitmapData function creates a pixmap of the given depth and then does a bitmap-format XPutImage of the data into it. The depth must be supported by the screen of the specified drawable, or a BadMatch error results. XCreatePixmapFromBitmapData can generate BadAlloc and Bad- Match errors. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu