Re: [gtk-list] GdkColorContext description





Federico "Quartic" Mena wrote:

> Hello, everyone
> 
> I have ported the color context code from XmHTML to Gdk, resulting in
> the GdkColorContext functionality.
> 
> The color context was originally written by John Cwikla, who is
> responsible for the X11 front-end to Mathematica.  It is very well
> written.

As far as I can remember he was also responsible of the widgets FAQ,
and worked for the FWF widget set (the one used by knews). 
Definitly a cool guy :)

> The idea of that all color allocation is done through a CC.  The nice
> thing about the CC is that it handles all visual/depth combinations,
> something that Gdk does not do right now.  For pseudocolor displays,
> it will allocate colors on demand to a color cube, rather than
> pre-allocating everything like GtkPreview does.  This should make
> Gtk/Gdk much more friendly to stuff like Netscape.
> 
> You create a color context with gdk_color_context_new().  Then you can
> simply request for a pixel value with gdk_color_context_get_pixel(),
> to which you pass the desired RGB values.  This function takes care of
> mapping the color to the nearest thing in the colormap, allocating the
> color, and all that yucky X stuff.

This can (could) also be used to include pixmaps (and pixmaps caching)
more easily as they depend on depth/colormap. How is handled the colormap
stuff for pseudocolor (8 bits display -> multicolormaps)? 
Does the gdk_color_context_get_*() use a cmap argument?

Anyway this CC is a *very* good idea.

> GdkColorContext is supposed to support all visuals in all depths, but
> the rest of Gdk does not support this.  Here is what needs to be done:
> 
> 	- Make the gdk_visual_init() support all visual/depth combinations.

all?

There are only a couple of usefull combinations:
>= 15 bits -> TrueColor
8 bits -> Pseudocolor (+TrueColor?)
< 8 bits -> PseudoColor

I must also say that to test this stuff, we might need peolpe with
high end gfx stations like SGI...
For example, on SGI the default visual is 8 bits PseudoColor, and 
you can access a 24 bits TrueColor visual if required (not always 
the case for gnome, but definitly usefull for gimp).
I had the problem with Amapi (I don't have the sources anymore), and
they have (had?) the problem with enlightenment.

<...>

> All this should make Gtk/Gdk friendly to displays with less than 8
> bits per pixel, and it should also make programming much easier for
> people who have to deal with color allocation themselves.
> 
> I would really appreciate if somebody could give a hand with this.
> Right now the GdkColorContext is *completely* untested.  We want to
> test it using the port to Gtk of the XmHTML widget.  I would
> appreciate if anyone could do separate testing.  It should be possible
> to do as the rest of Gdk is modified to use GdkColorContext.

Patrice.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]