[cairo] Fwd: Re: Enabling GTK drawing area alpha channel

Tobias Hoffmann lcairo-list at thax.hardliners.org
Wed May 18 02:22:27 PDT 2011

Manu wrote:
> On 05/17/2011 01:35 PM, Tobias Hoffmann wrote:
>>  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);
>>  }
> Sorry, sill one issue: gdk_screen_get_rgba_colormap() is not implemented
> in the win32 backend. The gdk visual depth is always reported as 24.
AFAIU this has to do with limitations on GDI surfaces on windows, so 
there's no easy workaround.
Maybe someone with better win32 knowledge can tell you (and me) more.
> Is there an alternative?
If you want composition only inside of your GTK window, you can do all 
the compositing yourself.
It is possible to "capture" GTK-Widgets by using an OffscreenWindow.
Still some required methods to do this with rgba on win32 are only 
available with GTK3 (namely to use a
32-bit cairo surface for the offscreen buffer)

But with a DrawingArea it seems you already have everything in a 
suitable cairo surface, so you wouldn't gain much (?).


More information about the cairo mailing list