[comp.windows.x] colors imaging in X

alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) (12/01/88)

I need some advice.  I've got some color imaging stuff written in SunView
which I am thinking of porting to X.  Can anyone tell me how practical
this is?  I understand that X can do color imaging.  The potential problem
is that Suns tend to "lose" the colormap of a window with its own 256
colors when the cursor is not within the window.  Is this a problem in X
as well, or does X somehow handle this properly?  (I get around this
problem in SunView with a lot of kludges.)

-- Alan    ..!{ames,cit-vax}!elroy!alan         * "But, seriously, what can
           alan@elroy.jpl.nasa.gov                 go wrong?"

hvr%kimba@Sun.COM (Heather Rose) (12/07/88)

In article <11695@elroy.Jpl.Nasa.Gov> alan@cogswell.Jpl.Nasa.Gov (Alan S. Mazer) writes:
>I need some advice.  I've got some color imaging stuff written in SunView
>which I am thinking of porting to X.  Can anyone tell me how practical
>this is?  I understand that X can do color imaging.  The potential problem
>is that Suns tend to "lose" the colormap of a window with its own 256
>colors when the cursor is not within the window.  Is this a problem in X
>as well, or does X somehow handle this properly?  (I get around this
>problem in SunView with a lot of kludges.)
>
>-- Alan    ..!{ames,cit-vax}!elroy!alan         * "But, seriously, what can
>           alan@elroy.jpl.nasa.gov                 go wrong?"

"Losing the color" when the window loses the focus is a limitation of the
display hardware.  This will happen with any window system with dynamic
colormaps on any display framebuffer that is only 8 bits deep.  One way
around this which X11 uses is the concept of a static colormap.  Each
window shares the same 256 colors, but you don't have the freedom to set
all 256 colors yourself.  X11 also will partition up the available 256
colors in various ways to allow some things to be shared while others are
settable.

If you have a framebuffer that is 24 bits deep, then you can store the true
RGB values for each pixel's color, thus colormaps are not needed, you always
get the color you've asked for, and there is no "flashing."

For detailed information on how X11 handles color, I would suggest the
chapter on color in the O'Reilly book and the "Visualizing X11 Clients"
paper to be given by Dave Lemke and David Rosenthal at this coming winter
USENIX conference.  It's a complicated subject.

Heather