[NTLUG:Discuss] Colors in X

kbrannen@gte.net kbrannen at gte.net
Fri Jan 10 11:37:25 CST 2003


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





More information about the Discuss mailing list