Re: ABI rules on accessing colormap->colors?



                        Hello, Peter !

On Mon, Sep 15, 2003 at 08:51:07PM +1000, Peter Zelezny wrote:
Well, cmap->colors is going to have correct values for static color
and grayscale as well as pseudocolor .... so checking ->colors != NULL
is probably the most general thing to do.

But why not just use gdk_colormap_query_color() and let GTK+ worry
about this?

Well, I'm trying to find a color inside the colormap that's as close as
possible to the R,G,B I actually want. I don't have the exact pixel value.

Basically, I'm doing a:
      gdk_colormap_alloc_color (cmap, color, TRUE, TRUE);
But on a most 8-bit PseudoColor displays, it fails, since the cmap is often
full. So I fall back to traversing the cmap->colors to see which is the
closest colour available. It gives pretty good results.

You can't really do that, since for any of the colors, there is no
indication whether it was allocated or not.

Also, setting writable to TRUE taints the color serching, since it demands
an exclusive colorcell.

I tried calling gdk_colormap_alloc_color() with the "best_match" arg TRUE,
hoping this would be done for me, but it is not.

What's your GDK version then ?


P.S.
    What's ABI ? :)



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