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

namespace Poppler {

	using System;
	using System.Collections;
	using System.Runtime.InteropServices;

#region Autogenerated code
	public class Page : GLib.Object {

		[Obsolete]
		protected Page(GLib.GType gtype) : base(gtype) {}
		public Page(IntPtr raw) : base(raw) {}

		protected Page() : base(IntPtr.Zero)
		{
			CreateNativeObject (new string [0], new GLib.Value [0]);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_type();

		public static new GLib.GType GType { 
			get {
				IntPtr raw_ret = poppler_page_get_type();
				GLib.GType ret = new GLib.GType(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_to_pixbuf(IntPtr raw, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, IntPtr pixbuf);

		public void RenderToPixbuf(int src_x, int src_y, int src_width, int src_height, double scale, int rotation, Gdk.Pixbuf pixbuf) {
			poppler_page_render_to_pixbuf(Handle, src_x, src_y, src_width, src_height, scale, rotation, pixbuf == null ? IntPtr.Zero : pixbuf.Handle);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_text(IntPtr raw, int style, IntPtr rect);

		public string GetText(Poppler.SelectionStyle style, Poppler.Rectangle rect) {
			IntPtr native_rect = GLib.Marshaller.StructureToPtrAlloc (rect);
			IntPtr raw_ret = poppler_page_get_text(Handle, (int) style, native_rect);
			string ret = GLib.Marshaller.PtrToStringGFree(raw_ret);
			rect = Poppler.Rectangle.New (native_rect);
			Marshal.FreeHGlobal (native_rect);
			return ret;
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_free_link_mapping(IntPtr list);

		public static void FreeLinkMapping(GLib.List list) {
			poppler_page_free_link_mapping(list == null ? IntPtr.Zero : list.Handle);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_get_crop_box(IntPtr raw, IntPtr rect);

		public void GetCropBox(Poppler.Rectangle rect) {
			IntPtr native_rect = GLib.Marshaller.StructureToPtrAlloc (rect);
			poppler_page_get_crop_box(Handle, native_rect);
			rect = Poppler.Rectangle.New (native_rect);
			Marshal.FreeHGlobal (native_rect);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_find_text(IntPtr raw, IntPtr text);

		public GLib.List FindText(string text) {
			IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup (text);
			IntPtr raw_ret = poppler_page_find_text(Handle, native_text);
			GLib.List ret = new GLib.List(raw_ret);
			GLib.Marshaller.Free (native_text);
			return ret;
		}

		[DllImport("poppler-glib")]
		static extern double poppler_page_get_duration(IntPtr raw);

		public double Duration { 
			get {
				double raw_ret = poppler_page_get_duration(Handle);
				double ret = raw_ret;
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_for_printing(IntPtr raw, IntPtr cairo);

		public void RenderForPrinting(Cairo.Context cairo) {
			poppler_page_render_for_printing(Handle, cairo == null ? IntPtr.Zero : cairo.Handle);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_selection_region_free(IntPtr region);

		public static void SelectionRegionFree(GLib.List region) {
			poppler_page_selection_region_free(region == null ? IntPtr.Zero : region.Handle);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_to_pixbuf_for_printing(IntPtr raw, int src_x, int src_y, int src_width, int src_height, double scale, int rotation, IntPtr pixbuf);

		public void RenderToPixbufForPrinting(int src_x, int src_y, int src_width, int src_height, double scale, int rotation, Gdk.Pixbuf pixbuf) {
			poppler_page_render_to_pixbuf_for_printing(Handle, src_x, src_y, src_width, src_height, scale, rotation, pixbuf == null ? IntPtr.Zero : pixbuf.Handle);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_thumbnail_pixbuf(IntPtr raw);

		public Gdk.Pixbuf ThumbnailPixbuf { 
			get {
				IntPtr raw_ret = poppler_page_get_thumbnail_pixbuf(Handle);
				Gdk.Pixbuf ret = new Gdk.Pixbuf(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_form_field_mapping(IntPtr raw);

		public GLib.List FormFieldMapping { 
			get {
				IntPtr raw_ret = poppler_page_get_form_field_mapping(Handle);
				GLib.List ret = new GLib.List(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern int poppler_page_get_index(IntPtr raw);

		public int Index { 
			get {
				int raw_ret = poppler_page_get_index(Handle);
				int ret = raw_ret;
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_transition(IntPtr raw);

		public Poppler.PageTransition Transition { 
			get {
				IntPtr raw_ret = poppler_page_get_transition(Handle);
				Poppler.PageTransition ret = Poppler.PageTransition.New (raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_selection_to_pixbuf(IntPtr raw, double scale, int rotation, IntPtr pixbuf, IntPtr selection, IntPtr old_selection, int style, IntPtr glyph_color, IntPtr background_color);

		public void RenderSelectionToPixbuf(double scale, int rotation, Gdk.Pixbuf pixbuf, Poppler.Rectangle selection, Poppler.Rectangle old_selection, Poppler.SelectionStyle style, Gdk.Color glyph_color, Gdk.Color background_color) {
			IntPtr native_selection = GLib.Marshaller.StructureToPtrAlloc (selection);
			IntPtr native_old_selection = GLib.Marshaller.StructureToPtrAlloc (old_selection);
			IntPtr native_glyph_color = GLib.Marshaller.StructureToPtrAlloc (glyph_color);
			IntPtr native_background_color = GLib.Marshaller.StructureToPtrAlloc (background_color);
			poppler_page_render_selection_to_pixbuf(Handle, scale, rotation, pixbuf == null ? IntPtr.Zero : pixbuf.Handle, native_selection, native_old_selection, (int) style, native_glyph_color, native_background_color);
			selection = Poppler.Rectangle.New (native_selection);
			Marshal.FreeHGlobal (native_selection);
			old_selection = Poppler.Rectangle.New (native_old_selection);
			Marshal.FreeHGlobal (native_old_selection);
			glyph_color = Gdk.Color.New (native_glyph_color);
			Marshal.FreeHGlobal (native_glyph_color);
			background_color = Gdk.Color.New (native_background_color);
			Marshal.FreeHGlobal (native_background_color);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_get_size(IntPtr raw, out double width, out double height);

		public void GetSize(out double width, out double height) {
			poppler_page_get_size(Handle, out width, out height);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_to_ps(IntPtr raw, IntPtr ps_file);

		public void RenderToPs(Poppler.PSFile ps_file) {
			poppler_page_render_to_ps(Handle, ps_file == null ? IntPtr.Zero : ps_file.Handle);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_link_mapping(IntPtr raw);

		public GLib.List LinkMapping { 
			get {
				IntPtr raw_ret = poppler_page_get_link_mapping(Handle);
				GLib.List ret = new GLib.List(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_annot_mapping(IntPtr raw);

		public GLib.List AnnotMapping { 
			get {
				IntPtr raw_ret = poppler_page_get_annot_mapping(Handle);
				GLib.List ret = new GLib.List(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_image_mapping(IntPtr raw);

		public GLib.List ImageMapping { 
			get {
				IntPtr raw_ret = poppler_page_get_image_mapping(Handle);
				GLib.List ret = new GLib.List(raw_ret);
				return ret;
			}
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_free_form_field_mapping(IntPtr list);

		public static void FreeFormFieldMapping(GLib.List list) {
			poppler_page_free_form_field_mapping(list == null ? IntPtr.Zero : list.Handle);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render_selection(IntPtr raw, IntPtr cairo, IntPtr selection, IntPtr old_selection, int style, IntPtr glyph_color, IntPtr background_color);

		public void RenderSelection(Cairo.Context cairo, Poppler.Rectangle selection, Poppler.Rectangle old_selection, Poppler.SelectionStyle style, Poppler.Color glyph_color, Poppler.Color background_color) {
			IntPtr native_selection = GLib.Marshaller.StructureToPtrAlloc (selection);
			IntPtr native_old_selection = GLib.Marshaller.StructureToPtrAlloc (old_selection);
			IntPtr native_glyph_color = GLib.Marshaller.StructureToPtrAlloc (glyph_color);
			IntPtr native_background_color = GLib.Marshaller.StructureToPtrAlloc (background_color);
			poppler_page_render_selection(Handle, cairo == null ? IntPtr.Zero : cairo.Handle, native_selection, native_old_selection, (int) style, native_glyph_color, native_background_color);
			selection = Poppler.Rectangle.New (native_selection);
			Marshal.FreeHGlobal (native_selection);
			old_selection = Poppler.Rectangle.New (native_old_selection);
			Marshal.FreeHGlobal (native_old_selection);
			glyph_color = Poppler.Color.New (native_glyph_color);
			Marshal.FreeHGlobal (native_glyph_color);
			background_color = Poppler.Color.New (native_background_color);
			Marshal.FreeHGlobal (native_background_color);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_free_annot_mapping(IntPtr list);

		public static void FreeAnnotMapping(GLib.List list) {
			poppler_page_free_annot_mapping(list == null ? IntPtr.Zero : list.Handle);
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_free_image_mapping(IntPtr list);

		public static void FreeImageMapping(GLib.List list) {
			poppler_page_free_image_mapping(list == null ? IntPtr.Zero : list.Handle);
		}

		[DllImport("poppler-glib")]
		static extern IntPtr poppler_page_get_selection_region(IntPtr raw, double scale, int style, IntPtr selection);

		public GLib.List GetSelectionRegion(double scale, Poppler.SelectionStyle style, Poppler.Rectangle selection) {
			IntPtr native_selection = GLib.Marshaller.StructureToPtrAlloc (selection);
			IntPtr raw_ret = poppler_page_get_selection_region(Handle, scale, (int) style, native_selection);
			GLib.List ret = new GLib.List(raw_ret);
			selection = Poppler.Rectangle.New (native_selection);
			Marshal.FreeHGlobal (native_selection);
			return ret;
		}

		[DllImport("poppler-glib")]
		static extern bool poppler_page_get_thumbnail_size(IntPtr raw, out int width, out int height);

		public bool GetThumbnailSize(out int width, out int height) {
			bool raw_ret = poppler_page_get_thumbnail_size(Handle, out width, out height);
			bool ret = raw_ret;
			return ret;
		}

		[DllImport("poppler-glib")]
		static extern void poppler_page_render(IntPtr raw, IntPtr cairo);

		public void Render(Cairo.Context cairo) {
			poppler_page_render(Handle, cairo == null ? IntPtr.Zero : cairo.Handle);
		}

#endregion
	}
}
