Path: utzoo!attcan!uunet!wugate!wuarchive!brutus.cs.uiuc.edu!tut.cis.ohio-state.edu!ucbvax!decwrl!mikey From: mikey@decwrl.dec.com (Mike Yang) Newsgroups: comp.windows.x Subject: Re: How does the X protocol deal with colors ? Message-ID: <24@gilroy.dec.com> Date: 28 Jul 89 16:53:02 GMT References: <8907261834.AA20315@expire.lcs.mit.edu> <8907262013.AA05801@expo.lcs.mit.edu> <4044@orca.WV.TEK.COM> Organization: DEC Western Software Lab Lines: 26 In article <8907262013.AA05801@expo.lcs.mit.edu> TRANLE@INTELLICORP.COM (Minh Tran-Le) writes: >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. In article <4044@orca.WV.TEK.COM> bobtl@toolbox.WV.TEK.COM () writes: >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. You can use GXxor to "invert" between your two colors if you set the plane mask of your GC to the bitwise exclusive or of the two pixel values. For instance, if you want to deal with the default foreground and background colors, set the plane mask of your GC to BlackPixel(dpy, screen) ^ WhitePixel(dpy, screen) and set the function to GXxor. Then, if you want to "invert" an area use XFillRectangle on the area with this GC. ----------------------------------------------------------------------------- Mike Yang Western Software Laboratory Digital Equipment Corporation mikey@wsl.dec.com decwrl!mikey (415) 853-6677