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

/*
Copyright (C) 2015 Johan Mattsson

This library is free software; you can redistribute it and/or modify 
it under the terms of the GNU Lesser General Public License as 
published by the Free Software Foundation; either version 3 of the 
License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
Lesser General Public License for more details.
*/

#include "birdfont.h"
#include <glib-object.h>
#include <cairo-gobject.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	BIRD_FONT_SCALED_BACKGROUND_PART_0_PROPERTY,
	BIRD_FONT_SCALED_BACKGROUND_PART_NUM_PROPERTIES
};
static GParamSpec* bird_font_scaled_background_part_properties[BIRD_FONT_SCALED_BACKGROUND_PART_NUM_PROPERTIES];
#define _cairo_surface_destroy0(var) ((var == NULL) ? NULL : (var = (cairo_surface_destroy (var), NULL)))

static gpointer bird_font_scaled_background_part_parent_class = NULL;

static void bird_font_scaled_background_part_finalize (GObject * obj);
static GType bird_font_scaled_background_part_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static gpointer
_cairo_surface_reference0 (gpointer self)
{
	return self ? cairo_surface_reference (self) : NULL;
}

BirdFontScaledBackgroundPart*
bird_font_scaled_background_part_construct (GType object_type,
                                            cairo_surface_t* image,
                                            gdouble scale,
                                            gint offset_x,
                                            gint offset_y)
{
	BirdFontScaledBackgroundPart * self = NULL;
	cairo_surface_t* _tmp0_;
	g_return_val_if_fail (image != NULL, NULL);
	self = (BirdFontScaledBackgroundPart*) g_object_new (object_type, NULL);
	_tmp0_ = _cairo_surface_reference0 (image);
	_cairo_surface_destroy0 (self->image);
	self->image = _tmp0_;
	self->scale = scale;
	self->offset_x = offset_x;
	self->offset_y = offset_y;
	return self;
}

BirdFontScaledBackgroundPart*
bird_font_scaled_background_part_new (cairo_surface_t* image,
                                      gdouble scale,
                                      gint offset_x,
                                      gint offset_y)
{
	return bird_font_scaled_background_part_construct (BIRD_FONT_TYPE_SCALED_BACKGROUND_PART, image, scale, offset_x, offset_y);
}

gdouble
bird_font_scaled_background_part_get_scale (BirdFontScaledBackgroundPart* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, 0.0);
	result = self->scale;
	return result;
}

cairo_surface_t*
bird_font_scaled_background_part_get_image (BirdFontScaledBackgroundPart* self)
{
	cairo_surface_t* _tmp0_;
	cairo_surface_t* _tmp1_;
	cairo_surface_t* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->image;
	_tmp1_ = _cairo_surface_reference0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static void
bird_font_scaled_background_part_class_init (BirdFontScaledBackgroundPartClass * klass,
                                             gpointer klass_data)
{
	bird_font_scaled_background_part_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = bird_font_scaled_background_part_finalize;
}

static void
bird_font_scaled_background_part_instance_init (BirdFontScaledBackgroundPart * self,
                                                gpointer klass)
{
}

static void
bird_font_scaled_background_part_finalize (GObject * obj)
{
	BirdFontScaledBackgroundPart * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_SCALED_BACKGROUND_PART, BirdFontScaledBackgroundPart);
	_cairo_surface_destroy0 (self->image);
	G_OBJECT_CLASS (bird_font_scaled_background_part_parent_class)->finalize (obj);
}

static GType
bird_font_scaled_background_part_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontScaledBackgroundPartClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_scaled_background_part_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontScaledBackgroundPart), 0, (GInstanceInitFunc) bird_font_scaled_background_part_instance_init, NULL };
	GType bird_font_scaled_background_part_type_id;
	bird_font_scaled_background_part_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontScaledBackgroundPart", &g_define_type_info, 0);
	return bird_font_scaled_background_part_type_id;
}

GType
bird_font_scaled_background_part_get_type (void)
{
	static volatile gsize bird_font_scaled_background_part_type_id__once = 0;
	if (g_once_init_enter (&bird_font_scaled_background_part_type_id__once)) {
		GType bird_font_scaled_background_part_type_id;
		bird_font_scaled_background_part_type_id = bird_font_scaled_background_part_get_type_once ();
		g_once_init_leave (&bird_font_scaled_background_part_type_id__once, bird_font_scaled_background_part_type_id);
	}
	return bird_font_scaled_background_part_type_id__once;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

