nancie@hal.CSS.GOV (Nancie Matson) (05/30/90)
This is probably a novice question, but I would like to know how to go about combining two Pixmaps (drawables) on the screen. I have a map generated by drawing an XImage structure into a Pixmap and using the XCopyArea function drawing it to the window. Now I have another drawable with some reference lines that I would like to "overlay" onto the first Pixmap. Both are in color and each time I try to use the XOR function I get the reference lines appearing in all black. Is it possible to XOR two Pixmaps and still retain the colors? It seems to work great with Black, when I try white, I get a reverse-video effect where if I have a blue background and green foreground and try to overlay white lines, I get black lines wherever there was foreground color and white lines where- ever there was background color. Does this make any sense??? If you have any idea what I may be talking about, Please E-mail your comments. I have a lot of "overlays" that I would like to place on the map, and I wanted to be able to draw each one in a different color as well as remove them at any time (that's why I chose to use XOR). If this is of any interest to anyone else, I'll be glad to summarize later on. Let me know! Thanx in advance! -Nancie nancie@hal.CSS.GOV
klee@wsl.dec.com (Ken Lee) (05/30/90)
In article <436@hal.CSS.GOV>, nancie@hal.CSS.GOV (Nancie Matson) writes: > Is it possible to XOR two Pixmaps and still retain the colors? This is a fairly common graphics problem. Simple binary logic functions like XOR are not usually appropriate when dealing with multi-bit color pixel values. A little arithmetic with your pixels will show you why. There are 2 ways to work around this. First, you can use images and whatever logic you want to combine pixels. Second, you can prepare your colormap so that the logic functions give you the results you want. The second technique is much faster and is commonly used with CAD applications. Any good computer graphics text should have examples of such colormaps. Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@wsl.dec.com uucp: uunet!decwrl!klee