Wrapper functions for setting up RGBA colormaps



I'd like to do some drawing using the alpha channel for blending. At
least one technique for doing this in raw Gtk+ is to query whether an
RGBA colormap exists:

  GdkScreen* screen = gtk_widget_get_screen(widget);

   GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen);
   gboolean supports_alpha = TRUE;

   if (!colormap)
   {
       /* display doesn't support compositing; fall back to RGB */
       colormap = gdk_screen_get_rgb_colormap(screen);
       supports_alpha = FALSE;
   }

   gtk_widget_set_colormap(widget, colormap);

One then can later inspect the 'supports_alpha' flag when setting up
the colormap on a Cairo context.

Gtkmm doesn't seem to offer wrappers for this RGBA colormap
fetching/setting. Should I continue to use the underlying Gtk+ API, or
is there a cleaner way of doing this kind of thing in Gtkmm?



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