Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: mouse@lightning.mcrcim.mcgill.EDU Newsgroups: comp.windows.x Subject: Re: How to get 24-bit pictures on DECstation 5000/200PXG? Message-ID: <9102060022.AA04657@lightning.McRCIM.McGill.EDU> Date: 6 Feb 91 00:22:56 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 73 > I have just gotten a DECstation 5000/200PXG up and [sort of] running, > but have run into a blank wall when it comes to using it for > displaying images (which is after all what I bought it for!). > Major problem: > - This is a 24 plane display with Z-buffer, but I can't for the life > of me find a demo/example/code_fragment/writeup/whatever that shows > me how to get a true color (24bit) picture up on the screen. The core X protocol can deal with the 24-bit part just fine, but you'll need an extension to get X access to the Z-buffer. But for what you want at the moment you don't need the Z-buffer anyway. > I.e., I want to specify 8 bits of red, 8 bits of green, and 8 bits > of blue for each pixel in a window directly (no color maps). > - The manual pages for the X11 utilities all speak explicitly of > colormaps, which I do NOT want to use. In X, `colormap' is a technical term. In that sense of the word, you do want to use them; all X displays do, even one-bit black and white displays. In your case, you want a colormap created on the DirectColor or TrueColor visual; from what you said above, I think you want the TrueColor one. Here is what the protocol document has to say: For DirectColor, a pixel value is decomposed into separate RGB subfields, and each subfield separately indexes the colormap for the corresponding value. The RGB values can be changed dynamically. TrueColor is treated in the same way as DirectColor except the colormap has predefined read-only RGB values. These values are server-dependent but provide linear or near-linear increasing ramps in each primary. > The xdpyinfo utility reports that my display has depth of 24 bits > (correct) and lists "visuals" with classes DirectColor and > TrueColor, but even these are listed as having a colormap size of > 256. This is normal. The colormap size for TrueColor and DirectColor will "usually" [quote from the protocol document] be 2 to the power of the largest color's number of bits - in your case, each primary has 8 bits, so you can expect 2^8 as the "size" of the colormap. What you want to do is, + Use XMatchVisualInfo to find a 24-bit TrueColor visual. + If it's the default visual, use the default colormap; if not, create a colormap for it. + Create a window with the visual and colormap you just found. + Construct your 24-bit pixel values by using the red-mask, green-mask, and blue-mask values for the Visual to plug your RGB values into a 24-bit word. Here is the protocol document's description of these three mask values: The red-mask, green-mask, and blue-mask are only defined for DirectColor and TrueColor. Each has one contiguous set of bits set to 1 with no intersections. Usually each mask has the same number of bits set to 1. If you have only a few colors to use and don't want to mess with figuring out the shifts and masks you need, you can just XAllocColor for each color. + Display your stuff! der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu