[comp.windows.x] Questions about X Colors

bj@oak.UUCP (Bjoren Davis) (04/30/91)

I have a number of questions concerning color under X that I was hoping someone
might be able to help me out on:
	1) How can I determine the precision of the RGB values?  That is,
	   how many high bits are actually valid?
	2) How can I figure out if a pixel is read only or read/write (besides
	   trying to re-write it)
	3) How can I get statistics about the cells in the current colormap?
	   For example, how many are read/only, how many are allocated
	   read/write for another client, how many my client has allocate	    read/write?

Thanks muchly.
--Bjoren Davis
(bj@oak.com)

tony@mcrsys.UUCP (Tony Becker) (05/01/91)

From article <9104291950.AA00569@oak.com>, by bj@oak.UUCP (Bjoren Davis):
> 
> I have a number of questions concerning color under X ....

try xdpyinfo for cmaps, pre-allocs, etc. as a first pass.
-- 
tony ,....

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (05/04/91)

> 1) How can I determine the precision of the RGB values?  That is, how
>    many high bits are actually valid?

This is the bits-per-rgb value in the XVisualInfo structure you get
back from XGetVisualInfo or XMatchVisualInfo.

> 2) How can I figure out if a pixel is read only or read/write
>    (besides trying to re-write it)

I don't think you can.  The theory is, I think, that you shouldn't
care: if you allocated it, you know, and if you didn't allocate it, you
have no business trying to change it.  (I don't entirely agree with
this, but that's irrelevant.)  What are you doing that you care, and
why isn't just trying to write the current rgb triple into it good
enough?

> 3) How can I get statistics about the cells in the current colormap?
>    For example, how many are read/only, how many are allocated
>    read/write for another client, how many my client has allocate
>    read/write?

What is the "current" colormap?  In any case, I know of no way to get
such information.

Of course, the mostly-negative answers to questions 2 and 3 apply only
to the core X protocol.  Extensions could be (and perhaps have been,
though I know of none) written that allow doing these things.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu