[comp.windows.x] Reverse-Video

Z.Wang@PURPLE.CS.UCL.AC.UK (Zheng Wang, Ext: 3701) (02/27/89)

Could anyone tell me whether there is an easy way in Xlib to
reverse-video a window and reverse back again?

What I want to do is to reverse a window representing a
component when it fails and reverse it back when it comes back.

Thanks in advance.


Zheng

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (02/28/89)

> Could anyone tell me whether there is an easy way in Xlib to
> reverse-video a window and reverse back again?

Depends on what you mean by "reverse".

If the area in the window only has two pixel values, you can use a filled
rectangle with a GC that has the following fields:

	function:	GXxor
	foreground:	(firstpixelvalue ^ secondpixelvalue)

If you have a more complicated image on the screen, you'll have to look
into allocating color planes (make sure you have a dynamic visual...) and
setting up the color cells so that the arithmetic works out.