[cairo] Enabling GTK drawing area alpha channel

Tobias Hoffmann lcairo-list at thax.hardliners.org
Tue May 17 04:35:37 PDT 2011

Emmanuel Thomas-Maurin wrote:
> The cairo surface format is created as 32-bit with an alpha channel.
> Then the drawing area seems to have a 24-bit format
> (gdk_visual_get_system()->depth = 24).
> My question is: Is it possible to have a 32-bit depth or to enable
> transparency for GTK drawing areas (other than gtk_window_set_opacity()
> for the whole window) ?
> Thanks for any hints.
Hint: Don't use the default visual for the widget:

GdkColormap *rgba = gdk_screen_get_rgba_colormap (screen);  // GTK3:  
gdk_screen_get_rgba_visual(screen), etc...
if (rgba && gdk_screen_is_composited (screen)) {
  gtk_widget_set_colormap(GTK_WIDGET(drawing_area), rgba);


More information about the cairo mailing list