Re: ABI rules on accessing colormap->colors?



On Mon, 2003-09-15 at 09:18, Peter Zelezny wrote:
On Mon, 15 Sep 2003 07:51:58 -0400
Owen Taylor <otaylor redhat com> wrote:

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.

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

Well, why don't you debug that? If you're right and there is a bug
there, then we can discuss workarounds, once we know what that bug is.

I didn't realize it could be a bug, I don't know much about Visuals.

You set 'best_match = TRUE', which is documented as:

  best_match : If TRUE, GDK will attempt to do matching against existing
colors if the color cannot be allocated as requested

And the allocation, you say, fails without any attempt to find a
approximate existing color, and you didn't realize it could be
a bug?

Here's a testcase: http://213.197.30.23/cmap.c

Comments at the top should give anyone an easy way to reproduce it. When I
run the program, it fails everytime. No problem in TrueColor however.

I have no particular interest in reconfiguring a server to run 
in pseudo-color at the moment The code in gdkcolor-x11.c for
implementing best_match isn't that complicated ... I'm pretty sure
you figure out what is going there and why it isn't working for
you.

However, if you aren't interested in that,
http://bugzilla.gnome.org/enter_bug.cgi
awaits.

Regards,
                                                Owen





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