4 // Simple helper methods for doing rgba drawing
6 // Author: Larry Ewing <lewing@novell.com>
10 using System
.Runtime
.InteropServices
;
15 static class CompositeHelper
{
16 [DllImport("libgdk-win32-2.0-0.dll")]
17 static extern IntPtr
gdk_cairo_create (IntPtr raw
);
19 [DllImport("libgdk-win32-2.0-0.dll")]
20 static extern IntPtr
gdk_screen_get_rgba_colormap (IntPtr screen
);
22 [DllImport("libgdk-win32-2.0-0.dll")]
23 static extern void gdk_cairo_region (IntPtr ctx
, IntPtr region
);
25 public static Cairo
.Context
Create (Gdk
.Drawable drawable
)
27 Cairo
.Context ctx
= new Cairo
.Context (gdk_cairo_create (drawable
.Handle
));
29 throw new Exception ("Couldn't create Cairo Graphics!");
34 public static void Region (Cairo
.Context ctx
, Gdk
.Region region
)
36 gdk_cairo_region (ctx
.Handle
, region
.Handle
);
39 public static Colormap
GetRgbaColormap (Screen screen
)
42 IntPtr raw_ret
= gdk_screen_get_rgba_colormap (screen
.Handle
);
43 Gdk
.Colormap ret
= GLib
.Object
.GetObject(raw_ret
) as Gdk
.Colormap
;
46 Gdk
.Visual visual
= Gdk
.Visual
.GetBestWithDepth (32);
48 Gdk
.Colormap cmap
= new Gdk
.Colormap (visual
, false);
49 System
.Console
.WriteLine ("fallback");
56 public static bool SetRgbaColormap (Widget w
)
58 Gdk
.Colormap cmap
= GetRgbaColormap (w
.Screen
);