Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!steinmetz!mercutio!lanzo From: lanzo@mercutio.steinmetz (Mark Lanzo) Newsgroups: comp.windows.x Subject: Need help with XPutImage Message-ID: <7538@steinmetz.steinmetz.UUCP> Date: Tue, 6-Oct-87 15:12:26 EDT Article-I.D.: steinmet.7538 Posted: Tue Oct 6 15:12:26 1987 Date-Received: Fri, 9-Oct-87 22:13:40 EDT Sender: root@steinmetz.steinmetz.UUCP Reply-To: lanzo@.UUCP (Mark Lanzo) Distribution: world Organization: General Electric CRD, Schenectady, NY Lines: 48 Help! I'm trying to display an image using the X system (X11), but don't seem to be getting anywhere. Let's see if someone out there can tell me what I'm doing wrong ... or if it's the X system at fault here. First off, a bit of background, since obviously I don't want to include the entire program here: I have opened an 8-plane PseudoColor window up on the screen, mapped it, created and installed a colormap for it, etc. etc. I can draw into the screen using various graphics commands, so I don't think there's anything fundamentally wrong with my window. I have an image of dimensions "width" by "height" (typically 300 x 300) of which each pixel is an unsigned byte. Image data is just consecutive bytes in a calloc'ed block of memory, no padding between lines, etc. so nothing extraordinary there. The fragment of code which I am trying to use to display the image looks like: ximage = XCreateImage(server,xvi.visual,8,image_fmt,0, img->ifsptr,width,height,8,0); XPutImage(server,w1,gc,ximage,0,0,0,0,width,height); where: image_fmt = ZPixmap; img is a structure unrelated to X; img->ifsptr is an "unsigned char *" which points to the actual image data. gc is a graphics context, basically your normal defaults (function = GXcopy, etc.), created with XCreateGC. xvi is an XVisualInfo structure filled in via XMatchVisualInfo()... and everything else should be obvious. The window that I'm attempting to put the image is 512x512, images are 300x300 or smaller. Now, when I run my program everything works fine up to the point of the XPutImage call (XCreateImage seems to return with no problems). Usually the program just freezes upon calling XPutImage, with a line or two of garbage pixels appearing at the very top of my window. Sometimes with smaller images I get several lines of garbage. The width of these lines look like they probably correspond to the width of the image, i.e., they don't extend all the way across window. So: is it my calling sequence or X which is out of wack? Thanks for any help... Mark