/* pdf.c generated by valac 0.16.0, the Vala compiler
 * generated from pdf.vala, do not modify */


#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <float.h>
#include <math.h>


#define PDFPC_VIEW_TYPE_BASE (pdfpc_view_base_get_type ())
#define PDFPC_VIEW_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_BASE, pdfpcViewBase))
#define PDFPC_VIEW_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_BASE, pdfpcViewBaseClass))
#define PDFPC_VIEW_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_BASE))
#define PDFPC_VIEW_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_BASE))
#define PDFPC_VIEW_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_BASE, pdfpcViewBaseClass))

typedef struct _pdfpcViewBase pdfpcViewBase;
typedef struct _pdfpcViewBaseClass pdfpcViewBaseClass;
typedef struct _pdfpcViewBasePrivate pdfpcViewBasePrivate;

#define PDFPC_RENDERER_TYPE_BASE (pdfpc_renderer_base_get_type ())
#define PDFPC_RENDERER_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBase))
#define PDFPC_RENDERER_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBaseClass))
#define PDFPC_RENDERER_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_TYPE_BASE))
#define PDFPC_RENDERER_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_TYPE_BASE))
#define PDFPC_RENDERER_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_TYPE_BASE, pdfpcRendererBaseClass))

typedef struct _pdfpcRendererBase pdfpcRendererBase;
typedef struct _pdfpcRendererBaseClass pdfpcRendererBaseClass;

#define PDFPC_VIEW_TYPE_PRERENDERING (pdfpc_view_prerendering_get_type ())
#define PDFPC_VIEW_PRERENDERING(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_PRERENDERING, pdfpcViewPrerendering))
#define PDFPC_VIEW_IS_PRERENDERING(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_PRERENDERING))
#define PDFPC_VIEW_PRERENDERING_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PDFPC_VIEW_TYPE_PRERENDERING, pdfpcViewPrerenderingIface))

typedef struct _pdfpcViewPrerendering pdfpcViewPrerendering;
typedef struct _pdfpcViewPrerenderingIface pdfpcViewPrerenderingIface;

#define PDFPC_VIEW_BEHAVIOUR_TYPE_DECORATABLE (pdfpc_view_behaviour_decoratable_get_type ())
#define PDFPC_VIEW_BEHAVIOUR_DECORATABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_DECORATABLE, pdfpcViewBehaviourDecoratable))
#define PDFPC_VIEW_BEHAVIOUR_IS_DECORATABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_DECORATABLE))
#define PDFPC_VIEW_BEHAVIOUR_DECORATABLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_DECORATABLE, pdfpcViewBehaviourDecoratableIface))

typedef struct _pdfpcViewBehaviourDecoratable pdfpcViewBehaviourDecoratable;
typedef struct _pdfpcViewBehaviourDecoratableIface pdfpcViewBehaviourDecoratableIface;

#define PDFPC_VIEW_BEHAVIOUR_TYPE_BASE (pdfpc_view_behaviour_base_get_type ())
#define PDFPC_VIEW_BEHAVIOUR_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBase))
#define PDFPC_VIEW_BEHAVIOUR_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBaseClass))
#define PDFPC_VIEW_BEHAVIOUR_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE))
#define PDFPC_VIEW_BEHAVIOUR_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE))
#define PDFPC_VIEW_BEHAVIOUR_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_BEHAVIOUR_TYPE_BASE, pdfpcViewBehaviourBaseClass))

typedef struct _pdfpcViewBehaviourBase pdfpcViewBehaviourBase;
typedef struct _pdfpcViewBehaviourBaseClass pdfpcViewBehaviourBaseClass;

#define PDFPC_VIEW_TYPE_DEFAULT (pdfpc_view_default_get_type ())
#define PDFPC_VIEW_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_DEFAULT, pdfpcViewDefault))
#define PDFPC_VIEW_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_DEFAULT, pdfpcViewDefaultClass))
#define PDFPC_VIEW_IS_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_DEFAULT))
#define PDFPC_VIEW_IS_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_DEFAULT))
#define PDFPC_VIEW_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_DEFAULT, pdfpcViewDefaultClass))

typedef struct _pdfpcViewDefault pdfpcViewDefault;
typedef struct _pdfpcViewDefaultClass pdfpcViewDefaultClass;
typedef struct _pdfpcViewDefaultPrivate pdfpcViewDefaultPrivate;

#define PDFPC_VIEW_TYPE_PDF (pdfpc_view_pdf_get_type ())
#define PDFPC_VIEW_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdf))
#define PDFPC_VIEW_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdfClass))
#define PDFPC_VIEW_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_PDF))
#define PDFPC_VIEW_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_PDF))
#define PDFPC_VIEW_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_PDF, pdfpcViewPdfClass))

typedef struct _pdfpcViewPdf pdfpcViewPdf;
typedef struct _pdfpcViewPdfClass pdfpcViewPdfClass;
typedef struct _pdfpcViewPdfPrivate pdfpcViewPdfPrivate;

#define PDFPC_RENDERER_TYPE_PDF (pdfpc_renderer_pdf_get_type ())
#define PDFPC_RENDERER_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdf))
#define PDFPC_RENDERER_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))
#define PDFPC_RENDERER_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_RENDERER_TYPE_PDF))
#define PDFPC_RENDERER_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_RENDERER_TYPE_PDF, pdfpcRendererPdfClass))

typedef struct _pdfpcRendererPdf pdfpcRendererPdf;
typedef struct _pdfpcRendererPdfClass pdfpcRendererPdfClass;

#define PDFPC_TYPE_PRESENTATION_CONTROLLER (pdfpc_presentation_controller_get_type ())
#define PDFPC_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationController))
#define PDFPC_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))
#define PDFPC_IS_PRESENTATION_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_IS_PRESENTATION_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_PRESENTATION_CONTROLLER))
#define PDFPC_PRESENTATION_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_PRESENTATION_CONTROLLER, pdfpcPresentationControllerClass))

typedef struct _pdfpcPresentationController pdfpcPresentationController;
typedef struct _pdfpcPresentationControllerClass pdfpcPresentationControllerClass;

#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION (pdfpc_view_behaviour_pdf_link_implementation_get_type ())
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION, pdfpcViewBehaviourPdfLinkImplementation))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION, pdfpcViewBehaviourPdfLinkImplementationClass))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_IS_IMPLEMENTATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_IS_IMPLEMENTATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION))
#define PDFPC_VIEW_BEHAVIOUR_PDF_LINK_IMPLEMENTATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_BEHAVIOUR_PDF_LINK_TYPE_IMPLEMENTATION, pdfpcViewBehaviourPdfLinkImplementationClass))

typedef struct _pdfpcViewBehaviourPdfLinkImplementation pdfpcViewBehaviourPdfLinkImplementation;
typedef struct _pdfpcViewBehaviourPdfLinkImplementationClass pdfpcViewBehaviourPdfLinkImplementationClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define PDFPC_METADATA_TYPE_BASE (pdfpc_metadata_base_get_type ())
#define PDFPC_METADATA_BASE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBase))
#define PDFPC_METADATA_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))
#define PDFPC_METADATA_IS_BASE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_IS_BASE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_BASE))
#define PDFPC_METADATA_BASE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_BASE, pdfpcMetadataBaseClass))

typedef struct _pdfpcMetadataBase pdfpcMetadataBase;
typedef struct _pdfpcMetadataBaseClass pdfpcMetadataBaseClass;

#define PDFPC_METADATA_TYPE_PDF (pdfpc_metadata_pdf_get_type ())
#define PDFPC_METADATA_PDF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdf))
#define PDFPC_METADATA_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))
#define PDFPC_METADATA_IS_PDF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_IS_PDF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_METADATA_TYPE_PDF))
#define PDFPC_METADATA_PDF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_METADATA_TYPE_PDF, pdfpcMetadataPdfClass))

typedef struct _pdfpcMetadataPdf pdfpcMetadataPdf;
typedef struct _pdfpcMetadataPdfClass pdfpcMetadataPdfClass;

#define PDFPC_TYPE_SCALER (pdfpc_scaler_get_type ())
#define PDFPC_SCALER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_TYPE_SCALER, pdfpcScaler))
#define PDFPC_SCALER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_TYPE_SCALER, pdfpcScalerClass))
#define PDFPC_IS_SCALER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_TYPE_SCALER))
#define PDFPC_IS_SCALER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_TYPE_SCALER))
#define PDFPC_SCALER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_TYPE_SCALER, pdfpcScalerClass))

typedef struct _pdfpcScaler pdfpcScaler;
typedef struct _pdfpcScalerClass pdfpcScalerClass;

typedef enum  {
	PDFPC_RENDERER_RENDER_ERROR_SLIDE_DOES_NOT_EXIST
} pdfpcRendererRenderError;
#define PDFPC_RENDERER_RENDER_ERROR pdfpc_renderer_render_error_quark ()
struct _pdfpcViewBase {
	GtkDrawingArea parent_instance;
	pdfpcViewBasePrivate * priv;
	pdfpcRendererBase* renderer;
};

struct _pdfpcViewBaseClass {
	GtkDrawingAreaClass parent_class;
	void (*display) (pdfpcViewBase* self, gint slide_number, gboolean force_redraw, GError** error);
	void (*fade_to_black) (pdfpcViewBase* self);
	void (*redraw) (pdfpcViewBase* self, GError** error);
	gint (*get_current_slide_number) (pdfpcViewBase* self);
};

struct _pdfpcViewPrerenderingIface {
	GTypeInterface parent_iface;
};

struct _pdfpcViewBehaviourDecoratableIface {
	GTypeInterface parent_iface;
	void (*associate_behaviour) (pdfpcViewBehaviourDecoratable* self, pdfpcViewBehaviourBase* behaviour);
};

struct _pdfpcViewDefault {
	pdfpcViewBase parent_instance;
	pdfpcViewDefaultPrivate * priv;
	gint current_slide_number;
	GdkPixmap* current_slide;
	gint n_slides;
	gint slide_limit;
	GList* behaviours;
};

struct _pdfpcViewDefaultClass {
	pdfpcViewBaseClass parent_class;
};

struct _pdfpcViewPdf {
	pdfpcViewDefault parent_instance;
	pdfpcViewPdfPrivate * priv;
};

struct _pdfpcViewPdfClass {
	pdfpcViewDefaultClass parent_class;
};


static gpointer pdfpc_view_pdf_parent_class = NULL;

GType pdfpc_view_base_get_type (void) G_GNUC_CONST;
GQuark pdfpc_renderer_render_error_quark (void);
GType pdfpc_renderer_base_get_type (void) G_GNUC_CONST;
GType pdfpc_view_prerendering_get_type (void) G_GNUC_CONST;
GType pdfpc_view_behaviour_base_get_type (void) G_GNUC_CONST;
GType pdfpc_view_behaviour_decoratable_get_type (void) G_GNUC_CONST;
GType pdfpc_view_default_get_type (void) G_GNUC_CONST;
GType pdfpc_view_pdf_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_VIEW_PDF_DUMMY_PROPERTY
};
GType pdfpc_renderer_pdf_get_type (void) G_GNUC_CONST;
GType pdfpc_presentation_controller_get_type (void) G_GNUC_CONST;
pdfpcViewPdf* pdfpc_view_pdf_new (pdfpcRendererPdf* renderer, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller);
pdfpcViewPdf* pdfpc_view_pdf_construct (GType object_type, pdfpcRendererPdf* renderer, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller);
pdfpcViewDefault* pdfpc_view_default_new (pdfpcRendererBase* renderer);
pdfpcViewDefault* pdfpc_view_default_construct (GType object_type, pdfpcRendererBase* renderer);
void pdfpc_view_behaviour_decoratable_associate_behaviour (pdfpcViewBehaviourDecoratable* self, pdfpcViewBehaviourBase* behaviour);
pdfpcViewBehaviourPdfLinkImplementation* pdfpc_view_behaviour_pdf_link_implementation_new (pdfpcPresentationController* presentation_controller);
pdfpcViewBehaviourPdfLinkImplementation* pdfpc_view_behaviour_pdf_link_implementation_construct (GType object_type, pdfpcPresentationController* presentation_controller);
GType pdfpc_view_behaviour_pdf_link_implementation_get_type (void) G_GNUC_CONST;
GType pdfpc_metadata_base_get_type (void) G_GNUC_CONST;
GType pdfpc_metadata_pdf_get_type (void) G_GNUC_CONST;
pdfpcViewPdf* pdfpc_view_pdf_from_metadata (pdfpcMetadataPdf* metadata, gint width, gint height, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller, GdkRectangle* scale_rect);
gdouble pdfpc_metadata_pdf_get_page_width (pdfpcMetadataPdf* self);
gdouble pdfpc_metadata_pdf_get_page_height (pdfpcMetadataPdf* self);
pdfpcScaler* pdfpc_scaler_new (gdouble width, gdouble height);
pdfpcScaler* pdfpc_scaler_construct (GType object_type, gdouble width, gdouble height);
GType pdfpc_scaler_get_type (void) G_GNUC_CONST;
void pdfpc_scaler_scale_to (pdfpcScaler* self, gint width, gint height, gboolean centered, gboolean allow_cutoff, GdkRectangle* result);
pdfpcRendererPdf* pdfpc_renderer_pdf_new (pdfpcMetadataPdf* metadata, gint width, gint height);
pdfpcRendererPdf* pdfpc_renderer_pdf_construct (GType object_type, pdfpcMetadataPdf* metadata, gint width, gint height);
pdfpcRendererPdf* pdfpc_view_pdf_get_renderer (pdfpcViewPdf* self);


/**
         * Default constructor restricted to Pdf renderers as input parameter
         */
pdfpcViewPdf* pdfpc_view_pdf_construct (GType object_type, pdfpcRendererPdf* renderer, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller) {
	pdfpcViewPdf * self = NULL;
	pdfpcRendererPdf* _tmp0_;
	pdfpcPresentationController* _tmp1_;
	pdfpcViewBehaviourPdfLinkImplementation* _tmp2_;
	pdfpcViewBehaviourPdfLinkImplementation* _tmp3_;
	g_return_val_if_fail (renderer != NULL, NULL);
	g_return_val_if_fail (presentation_controller != NULL, NULL);
	_tmp0_ = renderer;
	self = (pdfpcViewPdf*) pdfpc_view_default_construct (object_type, (pdfpcRendererBase*) _tmp0_);
	_tmp1_ = presentation_controller;
	_tmp2_ = pdfpc_view_behaviour_pdf_link_implementation_new (_tmp1_);
	_tmp3_ = _tmp2_;
	pdfpc_view_behaviour_decoratable_associate_behaviour ((pdfpcViewBehaviourDecoratable*) self, (pdfpcViewBehaviourBase*) _tmp3_);
	_g_object_unref0 (_tmp3_);
	return self;
}


pdfpcViewPdf* pdfpc_view_pdf_new (pdfpcRendererPdf* renderer, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller) {
	return pdfpc_view_pdf_construct (PDFPC_VIEW_TYPE_PDF, renderer, allow_black_on_end, presentation_controller);
}


/**
         * Create a new Pdf view directly from a file
         *
         * This is a convenience constructor which automatically create a full
         * metadata and rendering chain to be used with the pdf view. The given
         * width and height is used in conjunction with a scaler to maintain
         * aspect ration. The scale rectangle is provided in the scale_rect
         * argument.
         */
pdfpcViewPdf* pdfpc_view_pdf_from_metadata (pdfpcMetadataPdf* metadata, gint width, gint height, gboolean allow_black_on_end, pdfpcPresentationController* presentation_controller, GdkRectangle* scale_rect) {
	GdkRectangle _vala_scale_rect = {0};
	pdfpcViewPdf* result = NULL;
	pdfpcMetadataPdf* _tmp0_;
	gdouble _tmp1_ = 0.0;
	pdfpcMetadataPdf* _tmp2_;
	gdouble _tmp3_ = 0.0;
	pdfpcScaler* _tmp4_;
	pdfpcScaler* scaler;
	gint _tmp5_;
	gint _tmp6_;
	GdkRectangle _tmp7_ = {0};
	pdfpcMetadataPdf* _tmp8_;
	GdkRectangle _tmp9_;
	gint _tmp10_;
	GdkRectangle _tmp11_;
	gint _tmp12_;
	pdfpcRendererPdf* _tmp13_;
	pdfpcRendererPdf* renderer;
	gboolean _tmp14_;
	pdfpcPresentationController* _tmp15_;
	pdfpcViewPdf* _tmp16_;
	pdfpcViewPdf* _tmp17_;
	g_return_val_if_fail (metadata != NULL, NULL);
	g_return_val_if_fail (presentation_controller != NULL, NULL);
	_tmp0_ = metadata;
	_tmp1_ = pdfpc_metadata_pdf_get_page_width (_tmp0_);
	_tmp2_ = metadata;
	_tmp3_ = pdfpc_metadata_pdf_get_page_height (_tmp2_);
	_tmp4_ = pdfpc_scaler_new (_tmp1_, _tmp3_);
	scaler = _tmp4_;
	_tmp5_ = width;
	_tmp6_ = height;
	pdfpc_scaler_scale_to (scaler, _tmp5_, _tmp6_, TRUE, FALSE, &_tmp7_);
	_vala_scale_rect = _tmp7_;
	_tmp8_ = metadata;
	_tmp9_ = _vala_scale_rect;
	_tmp10_ = _tmp9_.width;
	_tmp11_ = _vala_scale_rect;
	_tmp12_ = _tmp11_.height;
	_tmp13_ = pdfpc_renderer_pdf_new (_tmp8_, _tmp10_, _tmp12_);
	renderer = _tmp13_;
	_tmp14_ = allow_black_on_end;
	_tmp15_ = presentation_controller;
	_tmp16_ = pdfpc_view_pdf_new (renderer, _tmp14_, _tmp15_);
	_tmp17_ = g_object_ref_sink (_tmp16_);
	result = _tmp17_;
	_g_object_unref0 (renderer);
	_g_object_unref0 (scaler);
	if (scale_rect) {
		*scale_rect = _vala_scale_rect;
	}
	return result;
}


/**
         * Return the currently used Pdf renderer
         */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


pdfpcRendererPdf* pdfpc_view_pdf_get_renderer (pdfpcViewPdf* self) {
	pdfpcRendererPdf* result = NULL;
	pdfpcRendererBase* _tmp0_;
	pdfpcRendererPdf* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = ((pdfpcViewBase*) self)->renderer;
	_tmp1_ = _g_object_ref0 (PDFPC_RENDERER_IS_PDF (_tmp0_) ? ((pdfpcRendererPdf*) _tmp0_) : NULL);
	result = _tmp1_;
	return result;
}


static void pdfpc_view_pdf_class_init (pdfpcViewPdfClass * klass) {
	pdfpc_view_pdf_parent_class = g_type_class_peek_parent (klass);
}


static void pdfpc_view_pdf_instance_init (pdfpcViewPdf * self) {
}


/**
     * View spezialized to work with Pdf renderers.
     *
     * This class is mainly needed to be decorated with pdf-link-interactions
     * signals.
     *
     * By default it does not implement any further functionality.
     */
GType pdfpc_view_pdf_get_type (void) {
	static volatile gsize pdfpc_view_pdf_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_view_pdf_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcViewPdfClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_view_pdf_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcViewPdf), 0, (GInstanceInitFunc) pdfpc_view_pdf_instance_init, NULL };
		GType pdfpc_view_pdf_type_id;
		pdfpc_view_pdf_type_id = g_type_register_static (PDFPC_VIEW_TYPE_DEFAULT, "pdfpcViewPdf", &g_define_type_info, 0);
		g_once_init_leave (&pdfpc_view_pdf_type_id__volatile, pdfpc_view_pdf_type_id);
	}
	return pdfpc_view_pdf_type_id__volatile;
}



