Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!hplabs!hpda!hpcuhb!hpindda!kmont From: kmont@hpindda.HP.COM (Kevin Montgomery) Newsgroups: comp.windows.x Subject: pixels -> Pixmap Message-ID: <3630004@hpindda.HP.COM> Date: 26 May 89 02:14:58 GMT Organization: HP Information Networks, Cupertino, CA Lines: 30 A slight thought question: You have an array of pixel values called pic[MAX_X, MAX_Y] that contain values 0-63. The value 0 corresponds to black, the value 63 corresponds to white, and there is a grey-scale in-between. You know how the set the colormap to the grey scale, so the values in the array map directly to lookup table values. The question is: Using X11, what is the best way to put these values into a pixmap to display. There are a few options: 1) play data manipulation games to massage the data into a Pixmap structure. 2) create 63 images for pixel values, then store these in the pixmap using XPutImage(). 3) allocate enough space in the pixmap and use XSetBackgroundPixel() for each pixel. 4) bag the pixmap idea and write directly to a window. 5) bag the whole idea and follow the Bagwan. I'd like to think (1) was the answer, but writing the routines could be a bitch, especially when one only has the XLib Programming Ref as a doc. If (1) is the way to go, does someone have a function laying around that'll do such a conversion? Is there a way I'm missing? Given that this is such an easy problem, I'd think it should be easy to do, but in practice... thanks in advance, kevbop