amccutchen@nasamail.nasa.GOV (ALAN MCCUTCHEN) (12/13/90)
I need to provide some kind of software blinking of colors. This is someting of a grey area for me (pardon the pun). Could a program be written to add a group of colors to the root window's default colormap, and periodically change the definition of those colors - thus affecting *all* windows on the display? Thanx, Alan ------------------------------------------------------------------------------- Alan McCutchen amccutchen@nasamail.nasa.gov Harris Space Systems Corporation 407-633-3835 FAX 407-633-3900 "No hunt beware open and close no credit" - Ernest T. Bass -------------------------------------------------------------------------------
dave@EXPO.LCS.MIT.EDU (12/14/90)
> Could a program be written to add a group of colors to the > root window's default colormap, and periodically change the > definition of those colors - thus affecting *all* windows > on the display? Look at the program coloredit in Doug Youngs toolkit book. Declare 2 colormap variables, say c1 and c2, and an array of XColor cells, here a1. Assign c1 the value returned by the DefaultColormap macro. Make sure you set the flags value in each XColor cell for RGB and the pixel value. Use XQueryColors with c1 to fill a1 with RGB values. Assign c2 the result from a call to XCreateColormap with the visual pointer returned by the DefaultVisual macro. Isn't this simple! Next call XStoreColors with c2 and a1 to initialize the pixel values in a1 to real hardware values. Call XInstallColorMap with c2 and a1, now your really cooking with oil! The idea from here on in is to manpulate c2 through your programs event driven mechanism. In order to set a color to frob, call XQueryColor with c2 and an XColor cell (we will call this x1). x1 has its pixel value set to index of the color represented by a1[i] that you want to change. The actual color change on the screen is accomplished by XStoreColor, feeding it x1 after you have have changed the rgb fields. Since you have used XInstall colormap on your display, every thing else on the screen will change. I hope the above helps. Its not a trivial operation. dave@expo.lcs.mit.edu you index into a1 for a given color and make a call to XQueryColor to get rbg values.