[NTLUG:Discuss] Colors in X

kbrannen@gte.net kbrannen at gte.net
Tue Jan 14 10:45:34 CST 2003


Steve Baker wrote:
> xiao li wrote:
> 
>>
>> In this program, the white color is toggled to black, black color to 
>> white, and all other colors to black. I just change the colormap, then 
>> call XStoreColors() and XFlush(). Let X server to redraw the color. 
>> This program runs correctly on Solaris or Windows NT if there is a X 
>> server installed.

Good, those are the functions I would expect you to use.

>>
>> This method has a limitation. You can't use more than 256 colors( if 
>> you know a way can get rid of this limitation, please tell me!! ). I 
>> am running this program on Redhat 7.1 and 7.3 Linux locally. But if I 
>> run this program on Linux machine but use xhost to display it on other 
>> platform, then it can work fine. So I guess it is because of the X 
>> server. Do I need to change or update the redhat x server?? Or how can 
>> I configure it to make it works with my blink function??
> 
> 
> I don't think you can assume the existance of a colour map in X.  Certainly
> there isn't one when the display is in 24 or 32 bit modes - just think how
> big the table would have to be!

Hmm, good point.  When I run xcmap, it looks very weird (and now that I pause 
to look at the man page, it says it only supports up to 8 bit depths. :-)

...
> I think you should just redraw the parts of the image you want to
> blink.  That's likely to be more efficient on modern graphics
> hardware - and it's sure as heck more portable.

I agree.  Doing it the "right" way is more portable, and you will thank 
yourself for that later down the road.

HTH,
Kevin





More information about the Discuss mailing list