home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!epb9.lbl.gov!envbvs
- From: envbvs@epb9.lbl.gov (Brian V. Smith)
- Newsgroups: comp.windows.x
- Subject: Re: GXcopy and GXxor
- Date: 24 Jul 1992 16:12:05 GMT
- Organization: lbl
- Lines: 42
- Distribution: world
- Message-ID: <24854@dog.ee.lbl.gov>
- References: <xia.711911424@odin> <MICHAEL.920724095149@maine.maine.EDU>
- NNTP-Posting-Host: 128.3.12.98
-
- In article <MICHAEL.920724095149@maine.maine.EDU>, michael@maine.maine.edu (Michael Johnson) writes:
-
-
- |> There's not really much you can do about it. When you XOR the pixels, the
- |> resulting pixel value is going to yield whatever color that pixel maps to.
- |> Do you understand what an XOR operation is?
- |>
- |> I find that a useful value for rubber-banding with XOR is -1, cast to Pixel.
- |> This usually yields a consistent color (usually black, though I've seen cases
- |> where an application actually allocated pixels that high, resulting in a
- |> different color).
-
- This has been asked many times and is in the FAQ:
-
- ----------------------------------------------------------------------
- Subject: 129) Why doesn't GXxor produce mathematically-correct color values?
-
- When using GXxor you may expect that drawing with a value of black on a
- background of black, for example, should produce white. However, the drawing
- operation does not work on RGB values but on colormap indices. The color that
- the resulting colormap index actually points to is undefined and visually
- random unless you have actually filled it in yourself. [On many X servers Black
- and White often 0/1 or 1/0; programs taking advantage of this mathematical
- coincidence will break.]
- If you want to be combining colors with GXxor, then you should be
- allocating a number of your own color cells and filling them with your chosen
- pre-computed values.
- If you want to use GXxor simply to switch between two colors, then you
- can take the shortcut of setting the background color in the GC to 0 and the
- foreground color to a value such that when it draws over red, say, the result
- is blue, and when it draws over blue the result is red. This foreground value
- is itself the XOR of the colormap indices of red and blue.
-
- [Thanks to Chris Flatters (cflatter@zia.aoc.nrao.EDU) and Ken Whaley
- (whaley@spectre.pa.dec.com), 2/91]
-
- ----------------------------------------------------------------------
-
- --
- Brian V. Smith (bvsmith@lbl.gov)
- Lawrence Berkeley Laboratory
- I don't speak for LBL; they don't pay me enough for that.
-