Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!cs.utexas.edu!uunet!zephyr.ens.tek.com!orca!toolbox!bobtl From: bobtl@toolbox.WV.TEK.COM Newsgroups: comp.windows.x Subject: Re: How does the X protocol deal with colors ? Message-ID: <4044@orca.WV.TEK.COM> Date: 27 Jul 89 18:05:25 GMT References: <8907261834.AA20315@expire.lcs.mit.edu> <8907262013.AA05801@expo.lcs.mit.edu> Sender: nobody@orca.WV.TEK.COM Reply-To: bobtl@toolbox.WV.TEK.COM () Organization: Tektronix, Inc., Wilsonville, OR Lines: 39 In article <8907262013.AA05801@expo.lcs.mit.edu> TRANLE@INTELLICORP.COM (Minh Tran-Le) writes: >What is the correct way to do consistent color operation across platforms ? > >This is because I am building and application that will run different >platforms using black&white or color displays. And I have seen that a >black pixel is usually 0 on a B&W display but on my color PS2 it is also 0 >while on my color vax decwindows display it is 252. > >Should I use only logical functions that always do the same thing on all the >displays like GXclear, GXcopy, GXnoop and GXset. But that is pretty >restrictive about what you can do with these operations. I infer from your question that you want to use any logical function and keep your image black and white on any display. Using these four functions only is your best bet. You have no control over what the screen Black/White Pixel is. Restrictive, yes, but you cannot use other logical functions unless you can control the relationship of colors within the map. Which leads to the next point. >Should I use my own colormap where I would know where all the colormap >entries are . But some machines will not allow you to install multiple >colormaps. And also it would interfere with the other applications running >on the same display. Switching colormaps has its problems but is sometimes necessary. You can use XAllocColorCells to set up a relationship within a portion of the colormap, if there is space. Set up your own black and white pixels with colors=1 and planes=1. Even setting up your own colormap doesn't solve the basic problem of controlling black and white. Suppose a screen has a pseudocolor visual with depth 8 and 254 entries in a map. If BlackPixel is 0, inverting it gives 255, which isn't even in your map. >Thanks, Tran Le. Bob Toole bobtl@toolbox.WV.TEK.COM