Re: question: colors, visuals, please help to understand

Alexander Chemeris wrote:

Thursday, August 22, 2002, 3:34:15 PM, you wrote:

Alexander Chemeris wrote:

Tuesday, August 20, 2002, 2:37:25 PM, you wrote:

 I need to allocate colors in PseudoColor and change their values
in runtime (gtk+-2.0). GDK allows me to allocate a writeable colors
in colormap via gdk_colormap_alloc_colors. But the problem is all
functions I've found are deprecated: gdk_colors_store,
gdk_color_change, gdk_colormap_change.

See for GdkRGB part of Gdk.

There's no direct support for writeable colours in GdkRGB.

Function used to allocate colors here is gdk_rgb_find_color().

Allocate - yes, but not to change the value of previously allocated
writeable colour. I need to have a constant pixel value (initialized
by gdk_colormap_alloc_colors in startup time) and ability to change
the R/G/B values of this pixel. I can't find non-deprecated
functions to do this - that's the main reason of my screams.

Hmm, why do you need writable colors?

Cause I'm using PseudoColor mode and I need to change the colours values in
runtime without frame recalculation (cause of performance reasons).

May be cmaps would help you?
See gdk_rgb_cmap_new()/gdk_rgb_cmap_free() and gdk_draw_indexed_image()
There isn't much documentation, but I think it all you need:
Allocate cmap, fill it with your colors, and then, when you need to
change color use something like this:
your_cmap->colors[color_number] = (r<<16) | (g<<8) | b;

This's ok for the gdk rgb, but it's not acceptable for me cause of performance reasons. It's better/simple/faster to use TrueColor directly than draw indexed
gdk rgb into drawables.

I never deal with this, but I saw at the gdk_rgb_indexed_to_stage()
function implementation in gdkrgb.c... ;-)
I think you must dig in the gdkrgb code and when you find appropriate
way - document it. ;-)

All I want - just to know has gtk+-2.0 non-deprecated writeable colours support
or no.


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