Re: Trying to set the palette in a window



On Wed, Jan 31, 2001 at 06:05:16PM -0500, Robert Young wrote:

I have a simple window which contains a drawrea widget.  The goal is to draw 
some rgb images into the drawarea, which I have been able to do using the 
gdk_draw_rgb_image function.

The problem is that the image(s) use a special palette, and when I paint the 
image the colors are off.

The palette information is a 256 array of the three color values (red, 
green, blue).  I just cannot determine how to create/associate a colormap 
containing the palette information with the window/drawarea.

Is gtk_widget_set_colormap(...) what you're after?

AFAICT, you have to call this on the main window, rather than the
drawing area. To quote some of my ugly code:

    gdk_colormap_alloc_colors( current_map, gdk_colours, 16, FALSE,
FALSE,
                               success );
    for(i=0,ok=1;i<16;i++) if(!success[i]) ok=0;
    if( !ok ) {
      fprintf(stderr,"%s: Still couldn't allocate all colours\n",
              fuse_progname);
      return 1;
    }
    gtk_widget_set_colormap( gtkui_window, current_map );

HTH,

Phil

-- 
  Philip Kendall <pak ast cam ac uk>
  http://www.srcf.ucam.org/~pak21/




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