PseudoColor and DirectColor visuals (was Re: Documentation?)
pharris at opentext.com
Thu Apr 9 08:17:25 PDT 2009
Patrick O'Donnell wrote:
>> Date: Wed, 08 Apr 2009 08:36:29 -0700
>> From: Alan Coopersmith <Alan.Coopersmith at Sun.COM>
>> Are there any systems in which you can write a million colors to a
>> PsuedoColor colormap? I've not often seen PseudoColor supporting
>> more than 8-bit/256 colors in the real world.
I don't think the app was writing a million colors. I think it was
designed for pixmaps with only a few colors and going insane on a JPEG.
A million AllocColor requests, and a million (minus ~200) BadAlloc replies.
> I saw a 16-bit PseudoColor visual once, even recently. Too bad it
> didn't really work. (Can't recall the server that offered it.)
That's... surprising. If you do remember which server offered it, I'd be
interested to know what it was.
The most I've seen is 12-bit PseudoColor (16bpp in order to keep the
pixel granularity sane, but only 12 significant bits, and therefore 4096
> Speaking of which -- the applications I'm maintaining are wedded to
> using a writable color map, which has always been PseudoColor, which,
> as you point out, pretty much means 8-bit. I've been toying with
> expanding the apps' repertoire to accepting a DirectColor visual, but
> I've noticed that not a lot of servers actually offer one. Would I be
> wasting my time adding in the necessary support for DirectColor?
> (Supporting TrueColor, alas, would be a royal pain, given the design
> of the apps.)
At least one app I've seen would use an OpenGL fragment shader to do the
PseudoColor => TrueColor translation at CopyArea time. Instead of
calling XStoreColors, you would load a new 1D texture and redo the copy.
Unfortunately, I don't know of a way to bind an X Pixmap into an OpenGL
texture, so that may not help you any. (The app in question was an
OpenGL-based app, so all its info was in pbuffers to begin with).
The RENDER extension already has mechanisms for copying PseudoColor
pixmaps to TrueColor displays, but it does not allow you to use your own
colormap. A new version of the RENDER extension with this feature added
could be interesting. I'm not sure if that helps you either, since I
don't know if you have the time and energy to write the code and submit
it for inclusion in future versions of the server. I also don't know if
the X.org maintainers would balk at the idea.
 Or whatever the OpenGL equivalent is called.
 You'd need two new requests: RenderCreateFormat, which takes a
colormap ID, and RenderCreateColormap, since the core CreateColormap
takes a visual ID and the whole point of this is to get PseudoColor
colormap support on servers that do not support a PseudoColor visual.
Open Text Connectivity Solutions Group
Peter Harris http://www.opentext.com/connectivity
Research and Development Phone: +1 905 762 6001
pharris at opentext.com Toll Free: 1 877 359 4866
More information about the xorg