elee6i5@jetson.uh.edu (09/07/90)
I am trying to display an image file consisting of 256X256 bytes of binary values. The display has a depth of 4 and I have allocated private color cells for 16 colors .(Since the display depth is 4, I guess it can display only 16 levels of gray). What values should I store in the red, blue and green fields of the array of XColor structure before calling XStoreColors in order to store appropriate primary color components corresponding to 16 levels of gray. When I try to display the image( ZPixmap pointing to my data) on the window calling XPutImage on "exposure", I get the following error message: X Protocol error detected by server: parameter mismatch Failed request major op code 72 X_PutImage Failed request minor op code 0 (if applicable) ResourceID 0x500003 in failed request (if applicable) Serial number of failed request 11 Current serial number in output stream 11 What could be the reason? Please mail your opinion ... Thanks in advance, .sundar elee6i5@jane.uh.edu sundar@izmir.ee.uh.edu
mouse@LARRY.MCRCIM.MCGILL.EDU (09/09/90)
> I am trying to display an image file consisting of 256X256 bytes of > binary values. The display has a depth of 4 and I have allocated > private color cells for 16 colors .(Since the display depth is 4, I > guess it can display only 16 levels of gray). Well, it can display at most 16 different colors. Whether you are restricted to shades of gray or not I couldn't say without more information. > What values should I store in the red, blue and green fields of the > array of XColor structure before calling XStoreColors in order to > store appropriate primary color components corresponding to 16 levels > of gray. Is that a question or a statement? If you want to just shade from 0=black to 15=white, you might use something like XColor colors[16]; for (i=0;i<16;i++) { colors[i].pixel = i; colors[i].red = (65535 * i) / 15; colors[i].green = (65535 * i) / 15; colors[i].blue = (65535 * i) / 15; colors[i].flags = DoRed | DoGreen | DoBlue; } Another reasonable formula to use for the red, green, and blue fields would be (65536 * i) / 16, but the results are slightly different and less likely to be quite what you want. > When I try to display the image( ZPixmap pointing to my data) on the > window calling XPutImage on "exposure", I get the following error > message: > X Protocol error detected by server: parameter mismatch > Failed request major op code 72 X_PutImage [...] > What could be the reason? In my experience (somewhat limited, where XPutImage is involved), this error is usually a result of a ZPixmap image's depth not matching the depth of the drawable it's being put to. Check the depth of your window or pixmap and make sure it matches the depth you specified when you created the XImage. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu