// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.

namespace Gdk {

	using System;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public partial class CairoHelper {

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gdk_cairo_create(IntPtr window);
		static d_gdk_cairo_create gdk_cairo_create = FuncLoader.LoadFunction<d_gdk_cairo_create>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_create"));

		[Obsolete]
		public static Cairo.Context Create(Gdk.Window window) {
			IntPtr raw_ret = gdk_cairo_create(window == null ? IntPtr.Zero : window.Handle);
			Cairo.Context ret = new Cairo.Context (raw_ret, true);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_draw_from_gl(IntPtr cr, IntPtr window, int source, int source_type, int buffer_scale, int x, int y, int width, int height);
		static d_gdk_cairo_draw_from_gl gdk_cairo_draw_from_gl = FuncLoader.LoadFunction<d_gdk_cairo_draw_from_gl>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_draw_from_gl"));

		public static void DrawFromGl(Cairo.Context cr, Gdk.Window window, int source, int source_type, int buffer_scale, int x, int y, int width, int height) {
			gdk_cairo_draw_from_gl(cr == null ? IntPtr.Zero : cr.Handle, window == null ? IntPtr.Zero : window.Handle, source, source_type, buffer_scale, x, y, width, height);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate bool d_gdk_cairo_get_clip_rectangle(IntPtr cr, IntPtr rect);
		static d_gdk_cairo_get_clip_rectangle gdk_cairo_get_clip_rectangle = FuncLoader.LoadFunction<d_gdk_cairo_get_clip_rectangle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_get_clip_rectangle"));

		public static bool GetClipRectangle(Cairo.Context cr, out Gdk.Rectangle rect) {
			IntPtr native_rect = Marshal.AllocHGlobal (Marshal.SizeOf<Gdk.Rectangle>());
			bool raw_ret = gdk_cairo_get_clip_rectangle(cr == null ? IntPtr.Zero : cr.Handle, native_rect);
			bool ret = raw_ret;
			rect = (Gdk.Rectangle) Marshal.PtrToStructure (native_rect, typeof (Gdk.Rectangle));
			Marshal.FreeHGlobal (native_rect);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gdk_cairo_get_drawing_context(IntPtr cr);
		static d_gdk_cairo_get_drawing_context gdk_cairo_get_drawing_context = FuncLoader.LoadFunction<d_gdk_cairo_get_drawing_context>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_get_drawing_context"));

		public static Gdk.DrawingContext GetDrawingContext(Cairo.Context cr) {
			IntPtr raw_ret = gdk_cairo_get_drawing_context(cr == null ? IntPtr.Zero : cr.Handle);
			Gdk.DrawingContext ret = GLib.Object.GetObject(raw_ret) as Gdk.DrawingContext;
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_rectangle(IntPtr cr, IntPtr rectangle);
		static d_gdk_cairo_rectangle gdk_cairo_rectangle = FuncLoader.LoadFunction<d_gdk_cairo_rectangle>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_rectangle"));

		public static void Rectangle(Cairo.Context cr, Gdk.Rectangle rectangle) {
			IntPtr native_rectangle = GLib.Marshaller.StructureToPtrAlloc (rectangle);
			gdk_cairo_rectangle(cr == null ? IntPtr.Zero : cr.Handle, native_rectangle);
			Marshal.FreeHGlobal (native_rectangle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_region(IntPtr cr, IntPtr region);
		static d_gdk_cairo_region gdk_cairo_region = FuncLoader.LoadFunction<d_gdk_cairo_region>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_region"));

		public static void Region(Cairo.Context cr, Cairo.Region region) {
			gdk_cairo_region(cr == null ? IntPtr.Zero : cr.Handle, region == null ? IntPtr.Zero : region.Handle);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gdk_cairo_region_create_from_surface(IntPtr surface);
		static d_gdk_cairo_region_create_from_surface gdk_cairo_region_create_from_surface = FuncLoader.LoadFunction<d_gdk_cairo_region_create_from_surface>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_region_create_from_surface"));

		public static Cairo.Region RegionCreateFromSurface(Cairo.Surface surface) {
			IntPtr raw_ret = gdk_cairo_region_create_from_surface(surface.Handle);
			Cairo.Region ret = new Cairo.Region(raw_ret);
			return ret;
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_set_source_color(IntPtr cr, IntPtr color);
		static d_gdk_cairo_set_source_color gdk_cairo_set_source_color = FuncLoader.LoadFunction<d_gdk_cairo_set_source_color>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_set_source_color"));

		[Obsolete]
		public static void SetSourceColor(Cairo.Context cr, Gdk.Color color) {
			IntPtr native_color = GLib.Marshaller.StructureToPtrAlloc (color);
			gdk_cairo_set_source_color(cr == null ? IntPtr.Zero : cr.Handle, native_color);
			Marshal.FreeHGlobal (native_color);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_set_source_pixbuf(IntPtr cr, IntPtr pixbuf, double pixbuf_x, double pixbuf_y);
		static d_gdk_cairo_set_source_pixbuf gdk_cairo_set_source_pixbuf = FuncLoader.LoadFunction<d_gdk_cairo_set_source_pixbuf>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_set_source_pixbuf"));

		public static void SetSourcePixbuf(Cairo.Context cr, Gdk.Pixbuf pixbuf, double pixbuf_x, double pixbuf_y) {
			gdk_cairo_set_source_pixbuf(cr == null ? IntPtr.Zero : cr.Handle, pixbuf == null ? IntPtr.Zero : pixbuf.Handle, pixbuf_x, pixbuf_y);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_set_source_rgba(IntPtr cr, IntPtr rgba);
		static d_gdk_cairo_set_source_rgba gdk_cairo_set_source_rgba = FuncLoader.LoadFunction<d_gdk_cairo_set_source_rgba>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_set_source_rgba"));

		public static void SetSourceRgba(Cairo.Context cr, Gdk.RGBA rgba) {
			IntPtr native_rgba = GLib.Marshaller.StructureToPtrAlloc (rgba);
			gdk_cairo_set_source_rgba(cr == null ? IntPtr.Zero : cr.Handle, native_rgba);
			Marshal.FreeHGlobal (native_rgba);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate void d_gdk_cairo_set_source_window(IntPtr cr, IntPtr window, double x, double y);
		static d_gdk_cairo_set_source_window gdk_cairo_set_source_window = FuncLoader.LoadFunction<d_gdk_cairo_set_source_window>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_set_source_window"));

		public static void SetSourceWindow(Cairo.Context cr, Gdk.Window window, double x, double y) {
			gdk_cairo_set_source_window(cr == null ? IntPtr.Zero : cr.Handle, window == null ? IntPtr.Zero : window.Handle, x, y);
		}

		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
		delegate IntPtr d_gdk_cairo_surface_create_from_pixbuf(IntPtr pixbuf, int scale, IntPtr for_window);
		static d_gdk_cairo_surface_create_from_pixbuf gdk_cairo_surface_create_from_pixbuf = FuncLoader.LoadFunction<d_gdk_cairo_surface_create_from_pixbuf>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gdk), "gdk_cairo_surface_create_from_pixbuf"));

		public static Cairo.Surface SurfaceCreateFromPixbuf(Gdk.Pixbuf pixbuf, int scale, Gdk.Window for_window) {
			IntPtr raw_ret = gdk_cairo_surface_create_from_pixbuf(pixbuf == null ? IntPtr.Zero : pixbuf.Handle, scale, for_window == null ? IntPtr.Zero : for_window.Handle);
			Cairo.Surface ret = Cairo.Surface.Lookup (raw_ret, true);
			return ret;
		}

#endregion
	}
}
