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


#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>


#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;
typedef struct _pdfpcRendererBasePrivate pdfpcRendererBasePrivate;

#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 _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

typedef enum  {
	PDFPC_RENDERER_RENDER_ERROR_SLIDE_DOES_NOT_EXIST
} pdfpcRendererRenderError;
#define PDFPC_RENDERER_RENDER_ERROR pdfpc_renderer_render_error_quark ()
struct _pdfpcRendererBase {
	GObject parent_instance;
	pdfpcRendererBasePrivate * priv;
	pdfpcMetadataBase* metadata;
	gint width;
	gint height;
};

struct _pdfpcRendererBaseClass {
	GObjectClass parent_class;
	GdkPixmap* (*render_to_pixmap) (pdfpcRendererBase* self, gint slide_number, GError** error);
	GdkPixmap* (*fade_to_black) (pdfpcRendererBase* self);
};

/**
     * Error domain used for every render error, which might occur
     */

static gpointer pdfpc_renderer_base_parent_class = NULL;

GType pdfpc_renderer_base_get_type (void) G_GNUC_CONST;
GQuark pdfpc_renderer_render_error_quark (void);
GType pdfpc_metadata_base_get_type (void) G_GNUC_CONST;
enum  {
	PDFPC_RENDERER_BASE_DUMMY_PROPERTY
};
pdfpcRendererBase* pdfpc_renderer_base_construct (GType object_type, pdfpcMetadataBase* metadata, gint width, gint height);
pdfpcMetadataBase* pdfpc_renderer_base_get_metadata (pdfpcRendererBase* self);
gint pdfpc_renderer_base_get_width (pdfpcRendererBase* self);
gint pdfpc_renderer_base_get_height (pdfpcRendererBase* self);
GdkPixmap* pdfpc_renderer_base_render_to_pixmap (pdfpcRendererBase* self, gint slide_number, GError** error);
static GdkPixmap* pdfpc_renderer_base_real_render_to_pixmap (pdfpcRendererBase* self, gint slide_number, GError** error);
GdkPixmap* pdfpc_renderer_base_fade_to_black (pdfpcRendererBase* self);
static GdkPixmap* pdfpc_renderer_base_real_fade_to_black (pdfpcRendererBase* self);
static void pdfpc_renderer_base_finalize (GObject* obj);


/**
         * Base constructor taking a metadata object as well as the desired
         * render width and height as parameters.
         */
static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


pdfpcRendererBase* pdfpc_renderer_base_construct (GType object_type, pdfpcMetadataBase* metadata, gint width, gint height) {
	pdfpcRendererBase * self = NULL;
	pdfpcMetadataBase* _tmp0_;
	pdfpcMetadataBase* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_val_if_fail (metadata != NULL, NULL);
	self = (pdfpcRendererBase*) g_object_new (object_type, NULL);
	_tmp0_ = metadata;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->metadata);
	self->metadata = _tmp1_;
	_tmp2_ = width;
	self->width = _tmp2_;
	_tmp3_ = height;
	self->height = _tmp3_;
	return self;
}


/**
         * Return the registered metadata object
         */
pdfpcMetadataBase* pdfpc_renderer_base_get_metadata (pdfpcRendererBase* self) {
	pdfpcMetadataBase* result = NULL;
	pdfpcMetadataBase* _tmp0_;
	pdfpcMetadataBase* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->metadata;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}


/**
         * Return the desired render width
         */
gint pdfpc_renderer_base_get_width (pdfpcRendererBase* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->width;
	result = _tmp0_;
	return result;
}


/**
         * Return the desired render height
         */
gint pdfpc_renderer_base_get_height (pdfpcRendererBase* self) {
	gint result = 0;
	gint _tmp0_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = self->height;
	result = _tmp0_;
	return result;
}


/**
         * Render the given slide_number to a Gdk.Pixmap and return it.
         *
         * If the requested slide is not available an
         * RenderError.SLIDE_DOES_NOT_EXIST error should be thrown.
         */
static GdkPixmap* pdfpc_renderer_base_real_render_to_pixmap (pdfpcRendererBase* self, gint slide_number, GError** error) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_renderer_base_render_to_pixmap'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


GdkPixmap* pdfpc_renderer_base_render_to_pixmap (pdfpcRendererBase* self, gint slide_number, GError** error) {
	g_return_val_if_fail (self != NULL, NULL);
	return PDFPC_RENDERER_BASE_GET_CLASS (self)->render_to_pixmap (self, slide_number, error);
}


/**
         * Fill the display with black. Useful for last "slide" or for fading
         * to black at certain points in the presentation.
         */
static GdkPixmap* pdfpc_renderer_base_real_fade_to_black (pdfpcRendererBase* self) {
	g_critical ("Type `%s' does not implement abstract method `pdfpc_renderer_base_fade_to_black'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}


GdkPixmap* pdfpc_renderer_base_fade_to_black (pdfpcRendererBase* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return PDFPC_RENDERER_BASE_GET_CLASS (self)->fade_to_black (self);
}


static void pdfpc_renderer_base_class_init (pdfpcRendererBaseClass * klass) {
	pdfpc_renderer_base_parent_class = g_type_class_peek_parent (klass);
	PDFPC_RENDERER_BASE_CLASS (klass)->render_to_pixmap = pdfpc_renderer_base_real_render_to_pixmap;
	PDFPC_RENDERER_BASE_CLASS (klass)->fade_to_black = pdfpc_renderer_base_real_fade_to_black;
	G_OBJECT_CLASS (klass)->finalize = pdfpc_renderer_base_finalize;
}


static void pdfpc_renderer_base_instance_init (pdfpcRendererBase * self) {
}


static void pdfpc_renderer_base_finalize (GObject* obj) {
	pdfpcRendererBase * self;
	self = PDFPC_RENDERER_BASE (obj);
	_g_object_unref0 (self->metadata);
	G_OBJECT_CLASS (pdfpc_renderer_base_parent_class)->finalize (obj);
}


/**
     * Renderer base class needed to be extended by every slide renderer.
     */
GType pdfpc_renderer_base_get_type (void) {
	static volatile gsize pdfpc_renderer_base_type_id__volatile = 0;
	if (g_once_init_enter (&pdfpc_renderer_base_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (pdfpcRendererBaseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_renderer_base_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcRendererBase), 0, (GInstanceInitFunc) pdfpc_renderer_base_instance_init, NULL };
		GType pdfpc_renderer_base_type_id;
		pdfpc_renderer_base_type_id = g_type_register_static (G_TYPE_OBJECT, "pdfpcRendererBase", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
		g_once_init_leave (&pdfpc_renderer_base_type_id__volatile, pdfpc_renderer_base_type_id);
	}
	return pdfpc_renderer_base_type_id__volatile;
}


GQuark pdfpc_renderer_render_error_quark (void) {
	return g_quark_from_static_string ("pdfpc_renderer_render_error-quark");
}



