/* Gradient.c generated by valac 0.56.17, the Vala compiler
 * generated from Gradient.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 <glib.h>
#include <float.h>
#include <math.h>
#include <gee.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_GRADIENT_0_PROPERTY,
	BIRD_FONT_GRADIENT_NUM_PROPERTIES
};
static GParamSpec* bird_font_gradient_properties[BIRD_FONT_GRADIENT_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

static gpointer bird_font_gradient_parent_class = NULL;

static void bird_font_gradient_finalize (GObject * obj);
static GType bird_font_gradient_get_type_once (void);

BirdFontGradient*
bird_font_gradient_construct (GType object_type)
{
	BirdFontGradient * self = NULL;
	GeeArrayList* _tmp0_;
	self = (BirdFontGradient*) g_object_new (object_type, NULL);
	self->x1 = (gdouble) 0;
	self->y1 = (gdouble) 0;
	self->x2 = (gdouble) 0;
	self->y2 = (gdouble) 0;
	_tmp0_ = gee_array_list_new (BIRD_FONT_TYPE_STOP, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_g_object_unref0 (self->stops);
	self->stops = _tmp0_;
	return self;
}

BirdFontGradient*
bird_font_gradient_new (void)
{
	return bird_font_gradient_construct (BIRD_FONT_TYPE_GRADIENT);
}

BirdFontGradient*
bird_font_gradient_copy (BirdFontGradient* self)
{
	BirdFontGradient* g = NULL;
	BirdFontGradient* _tmp0_;
	BirdFontGradient* _tmp1_;
	BirdFontGradient* _tmp2_;
	BirdFontGradient* _tmp3_;
	BirdFontGradient* _tmp4_;
	BirdFontGradient* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = bird_font_gradient_new ();
	g = _tmp0_;
	_tmp1_ = g;
	_tmp1_->x1 = self->x1;
	_tmp2_ = g;
	_tmp2_->y1 = self->y1;
	_tmp3_ = g;
	_tmp3_->x2 = self->x2;
	_tmp4_ = g;
	_tmp4_->y2 = self->y2;
	{
		GeeArrayList* _s_list = NULL;
		GeeArrayList* _tmp5_;
		gint _s_size = 0;
		GeeArrayList* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gint _s_index = 0;
		_tmp5_ = self->stops;
		_s_list = _tmp5_;
		_tmp6_ = _s_list;
		_tmp7_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp6_);
		_tmp8_ = _tmp7_;
		_s_size = _tmp8_;
		_s_index = -1;
		while (TRUE) {
			gint _tmp9_;
			gint _tmp10_;
			BirdFontStop* s = NULL;
			GeeArrayList* _tmp11_;
			gpointer _tmp12_;
			BirdFontGradient* _tmp13_;
			GeeArrayList* _tmp14_;
			BirdFontStop* _tmp15_;
			BirdFontStop* _tmp16_;
			BirdFontStop* _tmp17_;
			_s_index = _s_index + 1;
			_tmp9_ = _s_index;
			_tmp10_ = _s_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _s_list;
			_tmp12_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _s_index);
			s = (BirdFontStop*) _tmp12_;
			_tmp13_ = g;
			_tmp14_ = _tmp13_->stops;
			_tmp15_ = s;
			_tmp16_ = bird_font_stop_copy (_tmp15_);
			_tmp17_ = _tmp16_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp14_, _tmp17_);
			_g_object_unref0 (_tmp17_);
			_g_object_unref0 (s);
		}
	}
	result = g;
	return result;
}

static void
bird_font_gradient_class_init (BirdFontGradientClass * klass,
                               gpointer klass_data)
{
	bird_font_gradient_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = bird_font_gradient_finalize;
}

static void
bird_font_gradient_instance_init (BirdFontGradient * self,
                                  gpointer klass)
{
	self->id = -1;
}

static void
bird_font_gradient_finalize (GObject * obj)
{
	BirdFontGradient * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, BIRD_FONT_TYPE_GRADIENT, BirdFontGradient);
	_g_object_unref0 (self->stops);
	G_OBJECT_CLASS (bird_font_gradient_parent_class)->finalize (obj);
}

static GType
bird_font_gradient_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (BirdFontGradientClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) bird_font_gradient_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (BirdFontGradient), 0, (GInstanceInitFunc) bird_font_gradient_instance_init, NULL };
	GType bird_font_gradient_type_id;
	bird_font_gradient_type_id = g_type_register_static (G_TYPE_OBJECT, "BirdFontGradient", &g_define_type_info, 0);
	return bird_font_gradient_type_id;
}

GType
bird_font_gradient_get_type (void)
{
	static volatile gsize bird_font_gradient_type_id__once = 0;
	if (g_once_init_enter (&bird_font_gradient_type_id__once)) {
		GType bird_font_gradient_type_id;
		bird_font_gradient_type_id = bird_font_gradient_get_type_once ();
		g_once_init_leave (&bird_font_gradient_type_id__once, bird_font_gradient_type_id);
	}
	return bird_font_gradient_type_id__once;
}

