Alloc'ing and free'ing colors.



Hello All,

I'm working on an application that dynamically creates colors by mixing some 
colors that the user can change at runtime. My problem is, each time the user 
changes the colors, I have to gdk_color_alloc new mixed colors. This works, 
until my colormap fills up; then, I start getting weird almost-matches. 
(Obviously, I don't have a 24bit screen, I have to 'make do' with a 256 color 
one.)

I understand the problem (the colormap fills up), and see a possible solution 
in gdk_colors_free. However, from looking at the code for a while it seems that 
gdk_color_alloc puts the newly allocated color in the colormap, whereas 
gdk_colors_free doesn't remove them (in fact, that may not be correct, as they 
may have been color_alloc'ed from somewhere else in the application, too).

In other words, if I understand things correctly, gdk_color_alloc and 
gdk_colors_free can't really be used together in the way I want them to be. Is 
this true? (Please, tell me I'm wrong. :) Can it be fixed? Is there another 
solution?

Thanks,

Johannes.
--
vivivi - The editor of the Beast

Gathering Magician in a Magic-less world?




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