Hey,
> As i've never done any image building/manipulation with Mono I was
> wondering what API's I should be looking at. I'd like to be able to
> build visual views of a databases table structure. nothing complicated
> - just something to help with another project.
We also have bindings for Cairo on CVS.
The following patch lets you run the Cairo samples in Gtk#
? Pixmap.custom
? a
? image.png
? x
Index: Drawable.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gdk/Drawable.custom,v
retrieving revision 1.6
diff -u -r1.6 Drawable.custom
--- Drawable.custom 27 Oct 2003 20:00:15 -0000 1.6
+++ Drawable.custom 7 Feb 2004 16:02:46 -0000
@@ -41,3 +41,18 @@
gdk_draw_lines(Handle, gc.Handle, points, points.Length);
}
+[DllImport("libgdk-win32-2.0-0.dll")]
+internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw);
+
+[DllImport("libgdk-win32-2.0-0.dll")]
+internal static extern IntPtr gdk_x11_drawable_get_xid (IntPtr raw);
+
+ public virtual Cairo.Graphics CairoGraphics ()
+ {
+ Cairo.Graphics o = new Cairo.Graphics ();
+
+ IntPtr display = gdk_x11_drawable_get_xdisplay (Handle);
+ o.SetTargetDrawable (display, gdk_x11_drawable_get_xid (Handle));
+
+ return o;
+ }
Index: Makefile.in
===================================================================
RCS file: /cvs/public/gtk-sharp/gdk/Makefile.in,v
retrieving revision 1.16
diff -u -r1.16 Makefile.in
--- Makefile.in 29 Nov 2003 23:48:12 -0000 1.16
+++ Makefile.in 7 Feb 2004 16:02:46 -0000
@@ -17,7 +17,7 @@
$(ASSEMBLY): *.cs generated-stamp
$(MCS) --unsafe --target library \
- -r System.Drawing -r ../glib/glib-sharp.dll \
+ -r System.Drawing -r:Mono.Cairo -r ../glib/glib-sharp.dll \
-r ../pango/pango-sharp.dll -r ../atk/atk-sharp.dll \
-o $(ASSEMBLY) --recurse '*.cs'
Index: Window.custom
===================================================================
RCS file: /cvs/public/gtk-sharp/gdk/Window.custom,v
retrieving revision 1.2
diff -u -r1.2 Window.custom
--- Window.custom 18 Nov 2003 21:59:18 -0000 1.2
+++ Window.custom 7 Feb 2004 16:02:46 -0000
@@ -61,3 +61,24 @@
else
gdk_window_clear_area (Handle, rect.X, rect.Y, rect.Width,
rect.Height);
}
+
+ public Cairo.Graphics CairoGraphics (out int offset_x, out int offset_y)
+ {
+ IntPtr real_drawable;
+ Cairo.Graphics o = new Cairo.Graphics ();
+
+ gdk_window_get_internal_paint_info (Handle, out real_drawable, out
offset_x, out offset_y);
+ IntPtr x11 = gdk_x11_drawable_get_xid (real_drawable);
+ IntPtr display = gdk_x11_drawable_get_xdisplay (real_drawable);
+ o.SetTargetDrawable (display, x11);
+
+ return o;
+ }
+
+
+ public override Cairo.Graphics CairoGraphics ()
+ {
+ int x, y;
+ return CairoGraphics (out x, out y);
+ }
+