[NTLUG:Discuss] Colors in X

xiao li xiaoli4uh at hotmail.com
Fri Jan 10 14:07:01 CST 2003


Hi, Kevin,

Thanks for your reply.

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.

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 ran xdpyinfo on both Solaris and Linux system. The first difference I 
notice is the significant bits in color specification. That's why I want to 
ask you experts who know how to change it.

Thanks,

Lei Yu


>From: kbrannen at gte.net
>Reply-To: discuss at ntlug.org
>To: discuss at ntlug.org
>Subject: Re: [NTLUG:Discuss] Colors in X
>Date: Fri, 10 Jan 2003 11:37:25 -0600
>
>xiao li wrote:
>>Hi, guys,
>...
>>
>>So I just chang the color defined in colormap and call flush function. Let 
>>X server to handle the redraw. It works fine on windows NT and Solaris 
>>system. The only limitation is you can have only 256 colors. But on Linux, 
>>I can't make it work. I set the depth to 8. I think it means 256 colors.
>
>Yes.  If your display depth is 8, then you only have 256 colors.  The 
>number of colors is:  2^depth.  Need more colors?  Change your depth, 
>assuming your hardware can handle that. :-)
>
>>
>>I try to compare the difference on Solaris and Linux. When I run xdpyinfo. 
>>I found both depth value is 8, but the significant bits of in color 
>>specification is 6 bits on Linux and 8 bits on Solaris. I don't if this is 
>>the problem.
>>
>>Does anyone know how to solve my blink problem??
>
>You aren't giving enough info to help you.  How are you doing it?  Are you 
>using XStoreColor()?  Are you changing a GC?  Or what?  You're causing me 
>to dreg up some old memories, but I did used to do this sort of thing all 
>the time.  There are others here who can help too, but we need more info. 
>:-)
>
>My opinion (and it is only that) is that the significant bits is not your 
>problem.  It's either the wrong function calls, or perhaps an X server bug; 
>I would tend to believe the first.  I could be wrong, but you did ask. ;-)
>
>A fun story as a point.  Most X servers set colormap entry 0 to be black 
>and entry 1 to be white (or vica-versa).  And people came to expect that 
>and therefore wrote their programs that way (without allocating colors).  
>Then just to keep people honest, a company (might have been Sun) 
>implemented their X server to pre-allocate entry 0 to white, and entry 1 to 
>be white.  It broke some programs, but then they should have been broken 
>because they were based on untrue assumptions and weren't calling the 
>correct functions.  The point being, are you sure you are calling the right 
>functions, and all the functions you need to, and in the correct order?  I 
>ask because it can be confusing, I know I've made my share of mistakes.  
>(This is not be sarcastic or condescending, just trying to help you think 
>thru the problem.)
>
> > or Please tell me if I
>>can change the significant bits value.
>
>That would be in the reply I sent yesterday to your post then. :-)
>
>HTH,
>Kevin
>
>
>_______________________________________________
>https://ntlug.org/mailman/listinfo/discuss


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail





More information about the Discuss mailing list