[Xcb] [Semi-off-topic] Few questions regarding X programming

Maxim Levitsky maximlevitsky at gmail.com
Fri Jan 18 17:04:32 PST 2008


Hi,


I want to ask few questions about X programming.
( I am writing an small X toolkit)

I am more or less familiar with concepts of X, and I like them too.

I have few questions:

Those awful colormaps:
I have a strong wish not to support them at all, since most toady's display 
hardware
(especially desktop hardware) is capable of at least 16-bit.
I just want to request a TrueColor visual, and use the pixels directly (with 
correct shifts of course)

If I do support them, I have two schemes to do the support:
 * Choose a small range of colors, and preallocate colormap cells for all of
them, and cache the allocations in an array.
Each time the app asks for a color, find a approximate color in that array.
(It is similar to not using the colormaps at all, and besides if I choose to 
use system colormap, I will fill it with useless colors)


* Choose much wider range of colors, say always use 24-bit range, and allocate 
colors only on demand.
The range will be stored in a hash table.
Due to the fact that usually few colors are requested by applications I think 
this will be better. 
(Most toolkits have about 10-12 colors they use to decorate themselves)
But then the obvious question arises, how the X pixmaps are defined:

I know that there are 3 formats: 

XYBitmap - mono 'bitmap'
XYPixmap - Internet sources suggest that it holds all red values of pixels  
first, then all green values, and then the blue values - I will be glad to 
hear more about it, I am just curios.

ZPixmap - normal image, each pixel holds color information, but my question 
is:

Does ZPixmap hold RGB colors, or colormap indexes.


If it holds RGB, then I probably will use the second method, I will 
preallocate few colors, and use them to fill backgrounds, draw rectangles, 
some decorations, and most drawing will be done using pixmaps.
(Using MIT-SHM if available).

Besides, all info about the bitmap formats is welcome.
The X protocol spec seems to be sparse about it


2) Can I ask more questions If I have them? :-)

Best regards,
	Maxim Levitsky




More information about the Xcb mailing list