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

#include <glib-object.h>
#include <gdk/gdk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gtk/gtk.h>
#include <string.h>
#include <gsk/gsk.h>
#include <graphene-gobject.h>
#include <pango/pango.h>
#include <stdlib.h>
#include <adwaita.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define G4_TYPE_BASE_PAINTABLE (g4_base_paintable_get_type ())
#define G4_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintable))
#define G4_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))
#define G4_IS_BASE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_BASE_PAINTABLE))
#define G4_IS_BASE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_BASE_PAINTABLE))
#define G4_BASE_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_BASE_PAINTABLE, G4BasePaintableClass))

typedef struct _G4BasePaintable G4BasePaintable;
typedef struct _G4BasePaintableClass G4BasePaintableClass;
typedef struct _G4BasePaintablePrivate G4BasePaintablePrivate;
enum  {
	G4_BASE_PAINTABLE_0_PROPERTY,
	G4_BASE_PAINTABLE_PAINTABLE_PROPERTY,
	G4_BASE_PAINTABLE_NUM_PROPERTIES
};
static GParamSpec* g4_base_paintable_properties[G4_BASE_PAINTABLE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))
enum  {
	G4_BASE_PAINTABLE_FIRST_DRAW_SIGNAL,
	G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL,
	G4_BASE_PAINTABLE_NUM_SIGNALS
};
static guint g4_base_paintable_signals[G4_BASE_PAINTABLE_NUM_SIGNALS] = {0};

#define G4_TYPE_ROUND_PAINTABLE (g4_round_paintable_get_type ())
#define G4_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable))
#define G4_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))
#define G4_IS_ROUND_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_ROUND_PAINTABLE))
#define G4_IS_ROUND_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_ROUND_PAINTABLE))
#define G4_ROUND_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_ROUND_PAINTABLE, G4RoundPaintableClass))

typedef struct _G4RoundPaintable G4RoundPaintable;
typedef struct _G4RoundPaintableClass G4RoundPaintableClass;
typedef struct _G4RoundPaintablePrivate G4RoundPaintablePrivate;
enum  {
	G4_ROUND_PAINTABLE_0_PROPERTY,
	G4_ROUND_PAINTABLE_RATIO_PROPERTY,
	G4_ROUND_PAINTABLE_NUM_PROPERTIES
};
static GParamSpec* g4_round_paintable_properties[G4_ROUND_PAINTABLE_NUM_PROPERTIES];

#define G4_TYPE_CROSS_FADE_PAINTABLE (g4_cross_fade_paintable_get_type ())
#define G4_CROSS_FADE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintable))
#define G4_CROSS_FADE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintableClass))
#define G4_IS_CROSS_FADE_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_CROSS_FADE_PAINTABLE))
#define G4_IS_CROSS_FADE_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_CROSS_FADE_PAINTABLE))
#define G4_CROSS_FADE_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintableClass))

typedef struct _G4CrossFadePaintable G4CrossFadePaintable;
typedef struct _G4CrossFadePaintableClass G4CrossFadePaintableClass;
typedef struct _G4CrossFadePaintablePrivate G4CrossFadePaintablePrivate;
enum  {
	G4_CROSS_FADE_PAINTABLE_0_PROPERTY,
	G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY,
	G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY,
	G4_CROSS_FADE_PAINTABLE_NUM_PROPERTIES
};
static GParamSpec* g4_cross_fade_paintable_properties[G4_CROSS_FADE_PAINTABLE_NUM_PROPERTIES];

#define G4_TYPE_MATRIX_PAINTABLE (g4_matrix_paintable_get_type ())
#define G4_MATRIX_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintable))
#define G4_MATRIX_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintableClass))
#define G4_IS_MATRIX_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G4_TYPE_MATRIX_PAINTABLE))
#define G4_IS_MATRIX_PAINTABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), G4_TYPE_MATRIX_PAINTABLE))
#define G4_MATRIX_PAINTABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintableClass))

typedef struct _G4MatrixPaintable G4MatrixPaintable;
typedef struct _G4MatrixPaintableClass G4MatrixPaintableClass;
typedef struct _G4MatrixPaintablePrivate G4MatrixPaintablePrivate;
enum  {
	G4_MATRIX_PAINTABLE_0_PROPERTY,
	G4_MATRIX_PAINTABLE_ROTATION_PROPERTY,
	G4_MATRIX_PAINTABLE_SCALE_PROPERTY,
	G4_MATRIX_PAINTABLE_NUM_PROPERTIES
};
static GParamSpec* g4_matrix_paintable_properties[G4_MATRIX_PAINTABLE_NUM_PROPERTIES];
#define _gsk_render_node_unref0(var) ((var == NULL) ? NULL : (var = (gsk_render_node_unref (var), NULL)))
#define __vala_PangoFontDescription_free0(var) ((var == NULL) ? NULL : (var = (_vala_PangoFontDescription_free (var), NULL)))

struct _G4BasePaintable {
	GObject parent_instance;
	G4BasePaintablePrivate * priv;
};

struct _G4BasePaintableClass {
	GObjectClass parent_class;
	GdkPaintable* (*get_current_image) (G4BasePaintable* self);
	GdkPaintableFlags (*get_flags) (G4BasePaintable* self);
	gdouble (*get_intrinsic_aspect_ratio) (G4BasePaintable* self);
	gint (*get_intrinsic_width) (G4BasePaintable* self);
	gint (*get_intrinsic_height) (G4BasePaintable* self);
	void (*on_change) (G4BasePaintable* self, GdkPaintable* previous, GdkPaintable* paintable);
	void (*on_snapshot) (G4BasePaintable* self, GtkSnapshot* snapshot, gdouble width, gdouble height);
};

struct _G4BasePaintablePrivate {
	gboolean _first_draw;
	GdkPaintable* _paintable;
};

struct _G4RoundPaintable {
	G4BasePaintable parent_instance;
	G4RoundPaintablePrivate * priv;
};

struct _G4RoundPaintableClass {
	G4BasePaintableClass parent_class;
};

struct _G4RoundPaintablePrivate {
	GskRoundedRect _bounds;
	gdouble _ratio;
};

struct _G4CrossFadePaintable {
	G4BasePaintable parent_instance;
	G4CrossFadePaintablePrivate * priv;
};

struct _G4CrossFadePaintableClass {
	G4BasePaintableClass parent_class;
};

struct _G4CrossFadePaintablePrivate {
	GdkPaintable* _previous;
	gdouble _fade;
};

struct _G4MatrixPaintable {
	G4BasePaintable parent_instance;
	G4MatrixPaintablePrivate * priv;
};

struct _G4MatrixPaintableClass {
	G4BasePaintableClass parent_class;
};

struct _G4MatrixPaintablePrivate {
	gdouble _rotation;
	gdouble _scale;
};

static gint G4BasePaintable_private_offset;
static gpointer g4_base_paintable_parent_class = NULL;
static GdkPaintableInterface * g4_base_paintable_gdk_paintable_parent_iface = NULL;
static gint G4RoundPaintable_private_offset;
static gpointer g4_round_paintable_parent_class = NULL;
static gint G4CrossFadePaintable_private_offset;
static gpointer g4_cross_fade_paintable_parent_class = NULL;
static gint G4MatrixPaintable_private_offset;
static gpointer g4_matrix_paintable_parent_class = NULL;
VALA_EXTERN const gchar* g4_TEXT_SVG_FORMAT;
const gchar* g4_TEXT_SVG_FORMAT = "\n" \
"<svg width=\"128\" height=\"128\" xmlns=\"http://www.w3.org/2000/svg\"" \
">\n" \
"    <defs>\n" \
"        <linearGradient id=\"background\" x1=\"0\" x2=\"1\" y1=\"0\" y" \
"2=\"1\">\n" \
"            <stop offset=\"0%\" stop-color=\"#%06x\"/>\n" \
"            <stop offset=\"50%\" stop-color=\"#%06x\"/>\n" \
"            <stop offset=\"100%\" stop-color=\"#%06x\"/>\n" \
"        </linearGradient>\n" \
"    </defs>\n" \
"    <rect rx=\"12.8\" ry=\"12.8\" width=\"128\" height=\"128\" fill=\"" \
"url(#background)\"/>\n" \
"    <text x=\"%g\" y=\"%g\" fill=\"#e6e6e6\" font-family=\"Serif\" fon" \
"t-size=\"51.2\" font-weight=\"bold\">%s</text>\n" \
"</svg>\n" \
"    ";

VALA_EXTERN GType g4_base_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4BasePaintable, g_object_unref)
VALA_EXTERN GdkPaintable* g4_base_paintable_get_current_image (G4BasePaintable* self);
VALA_EXTERN GdkPaintableFlags g4_base_paintable_get_flags (G4BasePaintable* self);
VALA_EXTERN gdouble g4_base_paintable_get_intrinsic_aspect_ratio (G4BasePaintable* self);
VALA_EXTERN gint g4_base_paintable_get_intrinsic_width (G4BasePaintable* self);
VALA_EXTERN gint g4_base_paintable_get_intrinsic_height (G4BasePaintable* self);
VALA_EXTERN void g4_base_paintable_on_change (G4BasePaintable* self,
                                  GdkPaintable* previous,
                                  GdkPaintable* paintable);
VALA_EXTERN void g4_base_paintable_on_snapshot (G4BasePaintable* self,
                                    GtkSnapshot* snapshot,
                                    gdouble width,
                                    gdouble height);
VALA_EXTERN G4BasePaintable* g4_base_paintable_new (GdkPaintable* paintable);
VALA_EXTERN G4BasePaintable* g4_base_paintable_construct (GType object_type,
                                              GdkPaintable* paintable);
static GdkPaintable* g4_base_paintable_real_get_current_image (G4BasePaintable* self);
static GdkPaintableFlags g4_base_paintable_real_get_flags (G4BasePaintable* self);
static GdkPaintableFlags* _gdk_paintable_flags_dup (GdkPaintableFlags* self);
static gdouble g4_base_paintable_real_get_intrinsic_aspect_ratio (G4BasePaintable* self);
static gdouble* _double_dup (gdouble* self);
static gint g4_base_paintable_real_get_intrinsic_width (G4BasePaintable* self);
static gint* _int_dup (gint* self);
static gint g4_base_paintable_real_get_intrinsic_height (G4BasePaintable* self);
static void g4_base_paintable_real_snapshot (GdkPaintable* base,
                                      GdkSnapshot* shot,
                                      gdouble width,
                                      gdouble height);
static void g4_base_paintable_real_on_change (G4BasePaintable* self,
                                       GdkPaintable* previous,
                                       GdkPaintable* paintable);
static void g4_base_paintable_real_on_snapshot (G4BasePaintable* self,
                                         GtkSnapshot* snapshot,
                                         gdouble width,
                                         gdouble height);
VALA_EXTERN GdkPaintable* g4_base_paintable_get_paintable (G4BasePaintable* self);
VALA_EXTERN void g4_base_paintable_set_paintable (G4BasePaintable* self,
                                      GdkPaintable* value);
static void g4_base_paintable_finalize (GObject * obj);
static GType g4_base_paintable_get_type_once (void);
static void _vala_g4_base_paintable_get_property (GObject * object,
                                           guint property_id,
                                           GValue * value,
                                           GParamSpec * pspec);
static void _vala_g4_base_paintable_set_property (GObject * object,
                                           guint property_id,
                                           const GValue * value,
                                           GParamSpec * pspec);
VALA_EXTERN GType g4_round_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4RoundPaintable, g_object_unref)
VALA_EXTERN G4RoundPaintable* g4_round_paintable_new (GdkPaintable* paintable,
                                          gdouble ratio);
VALA_EXTERN G4RoundPaintable* g4_round_paintable_construct (GType object_type,
                                                GdkPaintable* paintable,
                                                gdouble ratio);
VALA_EXTERN gboolean g4_round_paintable_contains (G4RoundPaintable* self,
                                      graphene_point_t* point);
static void g4_round_paintable_real_on_snapshot (G4BasePaintable* base,
                                          GtkSnapshot* snapshot,
                                          gdouble width,
                                          gdouble height);
VALA_EXTERN void g4_compute_matrix (GtkSnapshot* snapshot,
                        gdouble width,
                        gdouble height,
                        gdouble rotation,
                        gdouble scale);
VALA_EXTERN gdouble g4_round_paintable_get_ratio (G4RoundPaintable* self);
VALA_EXTERN void g4_round_paintable_set_ratio (G4RoundPaintable* self,
                                   gdouble value);
static void g4_round_paintable_finalize (GObject * obj);
static GType g4_round_paintable_get_type_once (void);
static void _vala_g4_round_paintable_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static void _vala_g4_round_paintable_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec);
VALA_EXTERN GType g4_cross_fade_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4CrossFadePaintable, g_object_unref)
VALA_EXTERN G4CrossFadePaintable* g4_cross_fade_paintable_new (GdkPaintable* paintable);
VALA_EXTERN G4CrossFadePaintable* g4_cross_fade_paintable_construct (GType object_type,
                                                         GdkPaintable* paintable);
static void g4_cross_fade_paintable_real_on_change (G4BasePaintable* base,
                                             GdkPaintable* previous,
                                             GdkPaintable* paintable);
static void g4_cross_fade_paintable_real_on_snapshot (G4BasePaintable* base,
                                               GtkSnapshot* snapshot,
                                               gdouble width,
                                               gdouble height);
VALA_EXTERN gdouble g4_cross_fade_paintable_get_fade (G4CrossFadePaintable* self);
VALA_EXTERN void g4_cross_fade_paintable_set_fade (G4CrossFadePaintable* self,
                                       gdouble value);
VALA_EXTERN GdkPaintable* g4_cross_fade_paintable_get_previous (G4CrossFadePaintable* self);
VALA_EXTERN void g4_cross_fade_paintable_set_previous (G4CrossFadePaintable* self,
                                           GdkPaintable* value);
static void g4_cross_fade_paintable_finalize (GObject * obj);
static GType g4_cross_fade_paintable_get_type_once (void);
static void _vala_g4_cross_fade_paintable_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_g4_cross_fade_paintable_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);
VALA_EXTERN GType g4_matrix_paintable_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (G4MatrixPaintable, g_object_unref)
VALA_EXTERN G4MatrixPaintable* g4_matrix_paintable_new (GdkPaintable* paintable);
VALA_EXTERN G4MatrixPaintable* g4_matrix_paintable_construct (GType object_type,
                                                  GdkPaintable* paintable);
static void g4_matrix_paintable_real_on_snapshot (G4BasePaintable* base,
                                           GtkSnapshot* snapshot,
                                           gdouble width,
                                           gdouble height);
VALA_EXTERN gdouble g4_matrix_paintable_get_rotation (G4MatrixPaintable* self);
VALA_EXTERN void g4_matrix_paintable_set_rotation (G4MatrixPaintable* self,
                                       gdouble value);
VALA_EXTERN gdouble g4_matrix_paintable_get_scale (G4MatrixPaintable* self);
VALA_EXTERN void g4_matrix_paintable_set_scale (G4MatrixPaintable* self,
                                    gdouble value);
static void g4_matrix_paintable_finalize (GObject * obj);
static GType g4_matrix_paintable_get_type_once (void);
static void _vala_g4_matrix_paintable_get_property (GObject * object,
                                             guint property_id,
                                             GValue * value,
                                             GParamSpec * pspec);
static void _vala_g4_matrix_paintable_set_property (GObject * object,
                                             guint property_id,
                                             const GValue * value,
                                             GParamSpec * pspec);
VALA_EXTERN void g4_color_from_uint (guint color,
                         GdkRGBA* result);
VALA_EXTERN GdkPaintable* g4_create_blur_paintable (GtkWidget* widget,
                                        GdkPaintable* paintable,
                                        gint size,
                                        gdouble blur,
                                        gdouble opacity);
VALA_EXTERN PangoLayout* g4_create_center_text_layout (PangoContext* context,
                                           const gchar* family,
                                           gint width,
                                           gint height,
                                           gdouble font_size);
static void _vala_PangoFontDescription_free (PangoFontDescription* self);
VALA_EXTERN GdkPaintable* g4_create_text_paintable (PangoContext* context,
                                        const gchar* text,
                                        gint width,
                                        gint height,
                                        guint color_index);
VALA_EXTERN gchar* g4_create_text_svg (PangoContext* context,
                           const gchar* text,
                           guint color_index);
VALA_EXTERN GdkPaintable* g4_create_widget_paintable (GtkWidget* widget,
                                          graphene_point_t* point,
                                          const gchar* title,
                                          gint max_size);
VALA_EXTERN void g4_draw_outset_shadow (GtkSnapshot* snapshot,
                            graphene_rect_t* rect,
                            gfloat radius);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

const guint32 G4_BACKGROUND_COLORS[28] = {(guint32) 0xff83b6ecU, (guint32) 0xff337fdcU, (guint32) 0xff7ad9f1U, (guint32) 0xff0f9ac8U, (guint32) 0xff8de6b1U, (guint32) 0xff29ae74U, (guint32) 0xffb5e98aU, (guint32) 0xff6ab85bU, (guint32) 0xfff8e359U, (guint32) 0xffd29d09U, (guint32) 0xffffcb62U, (guint32) 0xffd68400U, (guint32) 0xffffa95aU, (guint32) 0xffed5b00U, (guint32) 0xfff78773U, (guint32) 0xffe62d42U, (guint32) 0xffe973abU, (guint32) 0xffe33b6aU, (guint32) 0xffcb78d4U, (guint32) 0xff9945b5U, (guint32) 0xff9e91e8U, (guint32) 0xff7a59caU, (guint32) 0xffe3cf9cU, (guint32) 0xffb08952U, (guint32) 0xffbe916dU, (guint32) 0xff785336U, (guint32) 0xffc0bfbcU, (guint32) 0xff6e6d71U};

static inline gpointer
g4_base_paintable_get_instance_private (G4BasePaintable* self)
{
	return G_STRUCT_MEMBER_P (self, G4BasePaintable_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

G4BasePaintable*
g4_base_paintable_construct (GType object_type,
                             GdkPaintable* paintable)
{
	G4BasePaintable * self = NULL;
	GdkPaintable* _tmp0_;
	self = (G4BasePaintable*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (paintable);
	_g_object_unref0 (self->priv->_paintable);
	self->priv->_paintable = _tmp0_;
	return self;
}

G4BasePaintable*
g4_base_paintable_new (GdkPaintable* paintable)
{
	return g4_base_paintable_construct (G4_TYPE_BASE_PAINTABLE, paintable);
}

static GdkPaintable*
g4_base_paintable_real_get_current_image (G4BasePaintable* self)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	GdkPaintable* _tmp2_ = NULL;
	GdkPaintable* _tmp4_ = NULL;
	GdkPaintable* _tmp5_;
	GdkPaintable* _tmp7_;
	GdkPaintable* result;
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		GdkPaintable* _tmp3_;
		_tmp3_ = gdk_paintable_get_current_image (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable));
		_g_object_unref0 (_tmp2_);
		_tmp2_ = _tmp3_;
	}
	_tmp5_ = _tmp2_;
	_tmp2_ = NULL;
	_tmp4_ = _tmp5_;
	if (_tmp4_ == NULL) {
		GdkPaintable* _tmp6_;
		_tmp6_ = _g_object_ref0 ((GdkPaintable*) self);
		_g_object_unref0 (_tmp4_);
		_tmp4_ = _tmp6_;
	}
	_tmp7_ = _tmp4_;
	_tmp4_ = NULL;
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, gdk_paintable_get_type (), GdkPaintable);
	_g_object_unref0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	return result;
}

GdkPaintable*
g4_base_paintable_get_current_image (G4BasePaintable* self)
{
	G4BasePaintableClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->get_current_image) {
		return _klass_->get_current_image (self);
	}
	return NULL;
}

static GdkPaintableFlags*
_gdk_paintable_flags_dup (GdkPaintableFlags* self)
{
	GdkPaintableFlags* dup;
	dup = g_new0 (GdkPaintableFlags, 1);
	memcpy (dup, self, sizeof (GdkPaintableFlags));
	return dup;
}

static gpointer
__gdk_paintable_flags_dup0 (gpointer self)
{
	return self ? _gdk_paintable_flags_dup (self) : NULL;
}

static GdkPaintableFlags
g4_base_paintable_real_get_flags (G4BasePaintable* self)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	GdkPaintableFlags* _tmp2_ = NULL;
	GdkPaintableFlags* _tmp5_ = NULL;
	GdkPaintableFlags* _tmp6_;
	GdkPaintableFlags* _tmp9_;
	GdkPaintableFlags _tmp10_;
	GdkPaintableFlags result;
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		GdkPaintableFlags _tmp3_;
		GdkPaintableFlags* _tmp4_;
		_tmp3_ = gdk_paintable_get_flags (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable));
		_tmp4_ = __gdk_paintable_flags_dup0 (&_tmp3_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp4_;
	}
	_tmp6_ = _tmp2_;
	_tmp2_ = NULL;
	_tmp5_ = _tmp6_;
	if (_tmp5_ == NULL) {
		GdkPaintableFlags _tmp7_;
		GdkPaintableFlags* _tmp8_;
		_tmp7_ = 0;
		_tmp8_ = __gdk_paintable_flags_dup0 (&_tmp7_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	}
	_tmp9_ = _tmp5_;
	_tmp5_ = NULL;
	_tmp10_ = (GdkPaintableFlags) (*_tmp9_);
	_g_free0 (_tmp9_);
	result = _tmp10_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	return result;
}

GdkPaintableFlags
g4_base_paintable_get_flags (G4BasePaintable* self)
{
	G4BasePaintableClass* _klass_;
	g_return_val_if_fail (self != NULL, 0U);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->get_flags) {
		return _klass_->get_flags (self);
	}
	return 0U;
}

static gdouble*
_double_dup (gdouble* self)
{
	gdouble* dup;
	dup = g_new0 (gdouble, 1);
	memcpy (dup, self, sizeof (gdouble));
	return dup;
}

static gpointer
__double_dup0 (gpointer self)
{
	return self ? _double_dup (self) : NULL;
}

static gdouble
g4_base_paintable_real_get_intrinsic_aspect_ratio (G4BasePaintable* self)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	gdouble* _tmp2_ = NULL;
	gdouble* _tmp5_ = NULL;
	gdouble* _tmp6_;
	gdouble* _tmp9_;
	gdouble _tmp10_;
	gdouble result;
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		gdouble _tmp3_;
		gdouble* _tmp4_;
		_tmp3_ = gdk_paintable_get_intrinsic_aspect_ratio (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable));
		_tmp4_ = __double_dup0 (&_tmp3_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp4_;
	}
	_tmp6_ = _tmp2_;
	_tmp2_ = NULL;
	_tmp5_ = _tmp6_;
	if (_tmp5_ == NULL) {
		gdouble _tmp7_;
		gdouble* _tmp8_;
		_tmp7_ = (gdouble) 1;
		_tmp8_ = __double_dup0 (&_tmp7_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	}
	_tmp9_ = _tmp5_;
	_tmp5_ = NULL;
	_tmp10_ = (gdouble) (*_tmp9_);
	_g_free0 (_tmp9_);
	result = _tmp10_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	return result;
}

gdouble
g4_base_paintable_get_intrinsic_aspect_ratio (G4BasePaintable* self)
{
	G4BasePaintableClass* _klass_;
	g_return_val_if_fail (self != NULL, -1.0);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->get_intrinsic_aspect_ratio) {
		return _klass_->get_intrinsic_aspect_ratio (self);
	}
	return -1.0;
}

static gint*
_int_dup (gint* self)
{
	gint* dup;
	dup = g_new0 (gint, 1);
	memcpy (dup, self, sizeof (gint));
	return dup;
}

static gpointer
__int_dup0 (gpointer self)
{
	return self ? _int_dup (self) : NULL;
}

static gint
g4_base_paintable_real_get_intrinsic_width (G4BasePaintable* self)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	gint* _tmp2_ = NULL;
	gint* _tmp5_ = NULL;
	gint* _tmp6_;
	gint* _tmp9_;
	gint _tmp10_;
	gint result;
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		gint _tmp3_;
		gint* _tmp4_;
		_tmp3_ = gdk_paintable_get_intrinsic_width (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable));
		_tmp4_ = __int_dup0 (&_tmp3_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp4_;
	}
	_tmp6_ = _tmp2_;
	_tmp2_ = NULL;
	_tmp5_ = _tmp6_;
	if (_tmp5_ == NULL) {
		gint _tmp7_;
		gint* _tmp8_;
		_tmp7_ = 1;
		_tmp8_ = __int_dup0 (&_tmp7_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	}
	_tmp9_ = _tmp5_;
	_tmp5_ = NULL;
	_tmp10_ = (gint) (*_tmp9_);
	_g_free0 (_tmp9_);
	result = _tmp10_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	return result;
}

gint
g4_base_paintable_get_intrinsic_width (G4BasePaintable* self)
{
	G4BasePaintableClass* _klass_;
	g_return_val_if_fail (self != NULL, -1);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->get_intrinsic_width) {
		return _klass_->get_intrinsic_width (self);
	}
	return -1;
}

static gint
g4_base_paintable_real_get_intrinsic_height (G4BasePaintable* self)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	gint* _tmp2_ = NULL;
	gint* _tmp5_ = NULL;
	gint* _tmp6_;
	gint* _tmp9_;
	gint _tmp10_;
	gint result;
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	_tmp2_ = NULL;
	if (_tmp0_ != NULL) {
		gint _tmp3_;
		gint* _tmp4_;
		_tmp3_ = gdk_paintable_get_intrinsic_height (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable));
		_tmp4_ = __int_dup0 (&_tmp3_);
		_g_free0 (_tmp2_);
		_tmp2_ = _tmp4_;
	}
	_tmp6_ = _tmp2_;
	_tmp2_ = NULL;
	_tmp5_ = _tmp6_;
	if (_tmp5_ == NULL) {
		gint _tmp7_;
		gint* _tmp8_;
		_tmp7_ = 1;
		_tmp8_ = __int_dup0 (&_tmp7_);
		_g_free0 (_tmp5_);
		_tmp5_ = _tmp8_;
	}
	_tmp9_ = _tmp5_;
	_tmp5_ = NULL;
	_tmp10_ = (gint) (*_tmp9_);
	_g_free0 (_tmp9_);
	result = _tmp10_;
	_g_free0 (_tmp5_);
	_g_free0 (_tmp2_);
	return result;
}

gint
g4_base_paintable_get_intrinsic_height (G4BasePaintable* self)
{
	G4BasePaintableClass* _klass_;
	g_return_val_if_fail (self != NULL, -1);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->get_intrinsic_height) {
		return _klass_->get_intrinsic_height (self);
	}
	return -1;
}

static void
g4_base_paintable_real_snapshot (GdkPaintable* base,
                                 GdkSnapshot* shot,
                                 gdouble width,
                                 gdouble height)
{
	G4BasePaintable * self;
	self = (G4BasePaintable*) base;
	g_return_if_fail (shot != NULL);
	if (self->priv->_first_draw) {
		self->priv->_first_draw = FALSE;
		g_signal_emit (self, g4_base_paintable_signals[G4_BASE_PAINTABLE_FIRST_DRAW_SIGNAL], 0);
	}
	g4_base_paintable_on_snapshot (self, G_TYPE_CHECK_INSTANCE_CAST (G_TYPE_CHECK_INSTANCE_TYPE (shot, gtk_snapshot_get_type ()) ? ((GtkSnapshot*) shot) : NULL, gtk_snapshot_get_type (), GtkSnapshot), width, height);
}

static void
g4_base_paintable_real_on_change (G4BasePaintable* self,
                                  GdkPaintable* previous,
                                  GdkPaintable* paintable)
{
	self->priv->_first_draw = previous != paintable;
}

void
g4_base_paintable_on_change (G4BasePaintable* self,
                             GdkPaintable* previous,
                             GdkPaintable* paintable)
{
	G4BasePaintableClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->on_change) {
		_klass_->on_change (self, previous, paintable);
	}
}

static void
g4_base_paintable_real_on_snapshot (G4BasePaintable* self,
                                    GtkSnapshot* snapshot,
                                    gdouble width,
                                    gdouble height)
{
	GdkPaintable* _tmp0_ = NULL;
	GdkPaintable* _tmp1_;
	g_return_if_fail (snapshot != NULL);
	_tmp1_ = self->priv->_paintable;
	_tmp0_ = _tmp1_;
	if (_tmp0_ != NULL) {
		gdk_paintable_snapshot (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, gdk_paintable_get_type (), GdkPaintable), (GdkSnapshot*) snapshot, width, height);
	}
}

void
g4_base_paintable_on_snapshot (G4BasePaintable* self,
                               GtkSnapshot* snapshot,
                               gdouble width,
                               gdouble height)
{
	G4BasePaintableClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = G4_BASE_PAINTABLE_GET_CLASS (self);
	if (_klass_->on_snapshot) {
		_klass_->on_snapshot (self, snapshot, width, height);
	}
}

GdkPaintable*
g4_base_paintable_get_paintable (G4BasePaintable* self)
{
	GdkPaintable* result;
	GdkPaintable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_paintable;
	result = _tmp0_;
	return result;
}

void
g4_base_paintable_set_paintable (G4BasePaintable* self,
                                 GdkPaintable* value)
{
	GdkPaintable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_paintable;
	if (_tmp0_ != value) {
		GdkPaintable* _tmp1_;
		GdkPaintable* _tmp2_;
		_tmp1_ = self->priv->_paintable;
		g4_base_paintable_on_change (self, _tmp1_, value);
		_tmp2_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_paintable);
		self->priv->_paintable = _tmp2_;
		g_signal_emit (self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_base_paintable_properties[G4_BASE_PAINTABLE_PAINTABLE_PROPERTY]);
}

static void
g4_base_paintable_class_init (G4BasePaintableClass * klass,
                              gpointer klass_data)
{
	g4_base_paintable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4BasePaintable_private_offset);
	((G4BasePaintableClass *) klass)->get_current_image = (GdkPaintable* (*) (G4BasePaintable*)) g4_base_paintable_real_get_current_image;
	((G4BasePaintableClass *) klass)->get_flags = (GdkPaintableFlags (*) (G4BasePaintable*)) g4_base_paintable_real_get_flags;
	((G4BasePaintableClass *) klass)->get_intrinsic_aspect_ratio = (gdouble (*) (G4BasePaintable*)) g4_base_paintable_real_get_intrinsic_aspect_ratio;
	((G4BasePaintableClass *) klass)->get_intrinsic_width = (gint (*) (G4BasePaintable*)) g4_base_paintable_real_get_intrinsic_width;
	((G4BasePaintableClass *) klass)->get_intrinsic_height = (gint (*) (G4BasePaintable*)) g4_base_paintable_real_get_intrinsic_height;
	((G4BasePaintableClass *) klass)->on_change = (void (*) (G4BasePaintable*, GdkPaintable*, GdkPaintable*)) g4_base_paintable_real_on_change;
	((G4BasePaintableClass *) klass)->on_snapshot = (void (*) (G4BasePaintable*, GtkSnapshot*, gdouble, gdouble)) g4_base_paintable_real_on_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_base_paintable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_base_paintable_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_base_paintable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_BASE_PAINTABLE_PAINTABLE_PROPERTY, g4_base_paintable_properties[G4_BASE_PAINTABLE_PAINTABLE_PROPERTY] = g_param_spec_object ("paintable", "paintable", "paintable", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g4_base_paintable_signals[G4_BASE_PAINTABLE_FIRST_DRAW_SIGNAL] = g_signal_new ("first-draw", G4_TYPE_BASE_PAINTABLE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL] = g_signal_new ("queue-draw", G4_TYPE_BASE_PAINTABLE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}

static void
g4_base_paintable_gdk_paintable_interface_init (GdkPaintableInterface * iface,
                                                gpointer iface_data)
{
	g4_base_paintable_gdk_paintable_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_current_image = (GdkPaintable* (*) (GdkPaintable*)) g4_base_paintable_get_current_image;
	iface->get_flags = (GdkPaintableFlags (*) (GdkPaintable*)) g4_base_paintable_get_flags;
	iface->get_intrinsic_aspect_ratio = (gdouble (*) (GdkPaintable*)) g4_base_paintable_get_intrinsic_aspect_ratio;
	iface->get_intrinsic_width = (gint (*) (GdkPaintable*)) g4_base_paintable_get_intrinsic_width;
	iface->get_intrinsic_height = (gint (*) (GdkPaintable*)) g4_base_paintable_get_intrinsic_height;
	iface->snapshot = (void (*) (GdkPaintable*, GdkSnapshot*, gdouble, gdouble)) g4_base_paintable_real_snapshot;
}

static void
g4_base_paintable_instance_init (G4BasePaintable * self,
                                 gpointer klass)
{
	self->priv = g4_base_paintable_get_instance_private (self);
	self->priv->_first_draw = FALSE;
	self->priv->_paintable = NULL;
}

static void
g4_base_paintable_finalize (GObject * obj)
{
	G4BasePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_BASE_PAINTABLE, G4BasePaintable);
	_g_object_unref0 (self->priv->_paintable);
	G_OBJECT_CLASS (g4_base_paintable_parent_class)->finalize (obj);
}

static GType
g4_base_paintable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4BasePaintableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_base_paintable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4BasePaintable), 0, (GInstanceInitFunc) g4_base_paintable_instance_init, NULL };
	static const GInterfaceInfo gdk_paintable_info = { (GInterfaceInitFunc) g4_base_paintable_gdk_paintable_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType g4_base_paintable_type_id;
	g4_base_paintable_type_id = g_type_register_static (G_TYPE_OBJECT, "G4BasePaintable", &g_define_type_info, 0);
	g_type_add_interface_static (g4_base_paintable_type_id, gdk_paintable_get_type (), &gdk_paintable_info);
	G4BasePaintable_private_offset = g_type_add_instance_private (g4_base_paintable_type_id, sizeof (G4BasePaintablePrivate));
	return g4_base_paintable_type_id;
}

GType
g4_base_paintable_get_type (void)
{
	static volatile gsize g4_base_paintable_type_id__once = 0;
	if (g_once_init_enter (&g4_base_paintable_type_id__once)) {
		GType g4_base_paintable_type_id;
		g4_base_paintable_type_id = g4_base_paintable_get_type_once ();
		g_once_init_leave (&g4_base_paintable_type_id__once, g4_base_paintable_type_id);
	}
	return g4_base_paintable_type_id__once;
}

static void
_vala_g4_base_paintable_get_property (GObject * object,
                                      guint property_id,
                                      GValue * value,
                                      GParamSpec * pspec)
{
	G4BasePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_BASE_PAINTABLE, G4BasePaintable);
	switch (property_id) {
		case G4_BASE_PAINTABLE_PAINTABLE_PROPERTY:
		g_value_set_object (value, g4_base_paintable_get_paintable (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_base_paintable_set_property (GObject * object,
                                      guint property_id,
                                      const GValue * value,
                                      GParamSpec * pspec)
{
	G4BasePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_BASE_PAINTABLE, G4BasePaintable);
	switch (property_id) {
		case G4_BASE_PAINTABLE_PAINTABLE_PROPERTY:
		g4_base_paintable_set_paintable (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
g4_round_paintable_get_instance_private (G4RoundPaintable* self)
{
	return G_STRUCT_MEMBER_P (self, G4RoundPaintable_private_offset);
}

G4RoundPaintable*
g4_round_paintable_construct (GType object_type,
                              GdkPaintable* paintable,
                              gdouble ratio)
{
	G4RoundPaintable * self = NULL;
	self = (G4RoundPaintable*) g4_base_paintable_construct (object_type, paintable);
	self->priv->_ratio = ratio;
	return self;
}

G4RoundPaintable*
g4_round_paintable_new (GdkPaintable* paintable,
                        gdouble ratio)
{
	return g4_round_paintable_construct (G4_TYPE_ROUND_PAINTABLE, paintable, ratio);
}

gboolean
g4_round_paintable_contains (G4RoundPaintable* self,
                             graphene_point_t* point)
{
	graphene_point_t _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (point != NULL, FALSE);
	_tmp0_ = *point;
	result = gsk_rounded_rect_contains_point (&self->priv->_bounds, &_tmp0_);
	return result;
}

static void
g4_round_paintable_real_on_snapshot (G4BasePaintable* base,
                                     GtkSnapshot* snapshot,
                                     gdouble width,
                                     gdouble height)
{
	G4RoundPaintable * self;
	graphene_rect_t rect = {0};
	gfloat size = 0.0F;
	gboolean circle = FALSE;
	gfloat radius = 0.0F;
	graphene_rect_t _tmp0_;
	gboolean saved = FALSE;
	self = (G4RoundPaintable*) base;
	g_return_if_fail (snapshot != NULL);
	memset (&rect, 0, sizeof (graphene_rect_t));
	size = (gfloat) MIN (width, height);
	circle = self->priv->_ratio >= 0.5;
	if (circle) {
		graphene_rect_init (&rect, ((gfloat) (width - size)) * 0.5f, ((gfloat) (height - size)) * 0.5f, size, size);
	} else {
		graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) width, (gfloat) height);
	}
	radius = (gfloat) (self->priv->_ratio * size);
	_tmp0_ = rect;
	gsk_rounded_rect_init_from_rect (&self->priv->_bounds, &_tmp0_, radius);
	saved = FALSE;
	if (radius > ((gfloat) 0)) {
		gboolean _tmp1_ = FALSE;
		GskRoundedRect _tmp2_;
		if (circle) {
			_tmp1_ = width != height;
		} else {
			_tmp1_ = FALSE;
		}
		if (_tmp1_) {
			gfloat scale = 0.0F;
			scale = ((gfloat) MAX (width, height)) / size;
			saved = TRUE;
			gtk_snapshot_save (snapshot);
			g4_compute_matrix (snapshot, width, height, (gdouble) 0, (gdouble) scale);
		}
		_tmp2_ = self->priv->_bounds;
		gtk_snapshot_push_rounded_clip (snapshot, &_tmp2_);
	}
	G4_BASE_PAINTABLE_CLASS (g4_round_paintable_parent_class)->on_snapshot (G_TYPE_CHECK_INSTANCE_CAST (self, G4_TYPE_BASE_PAINTABLE, G4BasePaintable), snapshot, width, height);
	if (radius > ((gfloat) 0)) {
		gtk_snapshot_pop (snapshot);
	}
	if (saved) {
		gtk_snapshot_restore (snapshot);
	}
}

gdouble
g4_round_paintable_get_ratio (G4RoundPaintable* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_ratio;
	return result;
}

void
g4_round_paintable_set_ratio (G4RoundPaintable* self,
                              gdouble value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_ratio != value) {
		self->priv->_ratio = value;
		g_signal_emit ((G4BasePaintable*) self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_round_paintable_properties[G4_ROUND_PAINTABLE_RATIO_PROPERTY]);
}

static void
g4_round_paintable_class_init (G4RoundPaintableClass * klass,
                               gpointer klass_data)
{
	g4_round_paintable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4RoundPaintable_private_offset);
	((G4BasePaintableClass *) klass)->on_snapshot = (void (*) (G4BasePaintable*, GtkSnapshot*, gdouble, gdouble)) g4_round_paintable_real_on_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_round_paintable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_round_paintable_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_round_paintable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_ROUND_PAINTABLE_RATIO_PROPERTY, g4_round_paintable_properties[G4_ROUND_PAINTABLE_RATIO_PROPERTY] = g_param_spec_double ("ratio", "ratio", "ratio", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
g4_round_paintable_instance_init (G4RoundPaintable * self,
                                  gpointer klass)
{
	self->priv = g4_round_paintable_get_instance_private (self);
	memset (&self->priv->_bounds, 0, sizeof (GskRoundedRect));
	self->priv->_ratio = (gdouble) 0;
}

static void
g4_round_paintable_finalize (GObject * obj)
{
	G4RoundPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable);
	G_OBJECT_CLASS (g4_round_paintable_parent_class)->finalize (obj);
}

static GType
g4_round_paintable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4RoundPaintableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_round_paintable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4RoundPaintable), 0, (GInstanceInitFunc) g4_round_paintable_instance_init, NULL };
	GType g4_round_paintable_type_id;
	g4_round_paintable_type_id = g_type_register_static (G4_TYPE_BASE_PAINTABLE, "G4RoundPaintable", &g_define_type_info, 0);
	G4RoundPaintable_private_offset = g_type_add_instance_private (g4_round_paintable_type_id, sizeof (G4RoundPaintablePrivate));
	return g4_round_paintable_type_id;
}

GType
g4_round_paintable_get_type (void)
{
	static volatile gsize g4_round_paintable_type_id__once = 0;
	if (g_once_init_enter (&g4_round_paintable_type_id__once)) {
		GType g4_round_paintable_type_id;
		g4_round_paintable_type_id = g4_round_paintable_get_type_once ();
		g_once_init_leave (&g4_round_paintable_type_id__once, g4_round_paintable_type_id);
	}
	return g4_round_paintable_type_id__once;
}

static void
_vala_g4_round_paintable_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	G4RoundPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable);
	switch (property_id) {
		case G4_ROUND_PAINTABLE_RATIO_PROPERTY:
		g_value_set_double (value, g4_round_paintable_get_ratio (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_round_paintable_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec)
{
	G4RoundPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_ROUND_PAINTABLE, G4RoundPaintable);
	switch (property_id) {
		case G4_ROUND_PAINTABLE_RATIO_PROPERTY:
		g4_round_paintable_set_ratio (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
g4_cross_fade_paintable_get_instance_private (G4CrossFadePaintable* self)
{
	return G_STRUCT_MEMBER_P (self, G4CrossFadePaintable_private_offset);
}

G4CrossFadePaintable*
g4_cross_fade_paintable_construct (GType object_type,
                                   GdkPaintable* paintable)
{
	G4CrossFadePaintable * self = NULL;
	self = (G4CrossFadePaintable*) g4_base_paintable_construct (object_type, paintable);
	return self;
}

G4CrossFadePaintable*
g4_cross_fade_paintable_new (GdkPaintable* paintable)
{
	return g4_cross_fade_paintable_construct (G4_TYPE_CROSS_FADE_PAINTABLE, paintable);
}

static void
g4_cross_fade_paintable_real_on_change (G4BasePaintable* base,
                                        GdkPaintable* previous,
                                        GdkPaintable* paintable)
{
	G4CrossFadePaintable * self;
	GdkPaintable* _tmp0_;
	self = (G4CrossFadePaintable*) base;
	_tmp0_ = _g_object_ref0 (previous);
	_g_object_unref0 (self->priv->_previous);
	self->priv->_previous = _tmp0_;
	G4_BASE_PAINTABLE_CLASS (g4_cross_fade_paintable_parent_class)->on_change (G_TYPE_CHECK_INSTANCE_CAST (self, G4_TYPE_BASE_PAINTABLE, G4BasePaintable), previous, paintable);
}

static void
g4_cross_fade_paintable_real_on_snapshot (G4BasePaintable* base,
                                          GtkSnapshot* snapshot,
                                          gdouble width,
                                          gdouble height)
{
	G4CrossFadePaintable * self;
	gboolean _tmp0_ = FALSE;
	self = (G4CrossFadePaintable*) base;
	g_return_if_fail (snapshot != NULL);
	if (self->priv->_fade > ((gdouble) 0)) {
		GdkPaintable* _tmp1_;
		_tmp1_ = self->priv->_previous;
		_tmp0_ = _tmp1_ != NULL;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gdouble width2 = 0.0;
		gdouble height2 = 0.0;
		GdkPaintable* prev = NULL;
		GdkPaintable* _tmp2_;
		GdkPaintable* _tmp3_;
		gdouble ratio2 = 0.0;
		GdkPaintable* _tmp4_;
		graphene_point_t point = {0};
		gboolean different = FALSE;
		GdkPaintable* _tmp6_;
		width2 = width;
		height2 = height;
		_tmp2_ = self->priv->_previous;
		_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, gdk_paintable_get_type (), GdkPaintable));
		prev = _tmp3_;
		_tmp4_ = prev;
		ratio2 = gdk_paintable_get_intrinsic_aspect_ratio (_tmp4_);
		memset (&point, 0, sizeof (graphene_point_t));
		different = ratio2 != g4_base_paintable_get_intrinsic_aspect_ratio ((G4BasePaintable*) self);
		if (different) {
			gdouble max_side = 0.0;
			graphene_point_t _tmp5_;
			max_side = MAX (width, height);
			if (ratio2 < ((gdouble) 1)) {
				height2 = max_side;
				width2 = height2 * ratio2;
			} else {
				width2 = max_side;
				height2 = width2 / ratio2;
			}
			point.x = ((gfloat) (width - width2)) * 0.5f;
			point.y = ((gfloat) (height - height2)) * 0.5f;
			_tmp5_ = point;
			gtk_snapshot_translate (snapshot, &_tmp5_);
		}
		gtk_snapshot_push_opacity (snapshot, self->priv->_fade);
		_tmp6_ = prev;
		gdk_paintable_snapshot (_tmp6_, (GdkSnapshot*) snapshot, width2, height2);
		gtk_snapshot_pop (snapshot);
		if (different) {
			graphene_point_t _tmp7_;
			graphene_point_t _tmp8_;
			graphene_point_t _tmp9_;
			_tmp7_ = point;
			point.x = -_tmp7_.x;
			_tmp8_ = point;
			point.y = -_tmp8_.y;
			_tmp9_ = point;
			gtk_snapshot_translate (snapshot, &_tmp9_);
		}
		_g_object_unref0 (prev);
	}
	if (self->priv->_fade > ((gdouble) 0)) {
		gtk_snapshot_push_opacity (snapshot, 1 - self->priv->_fade);
	}
	G4_BASE_PAINTABLE_CLASS (g4_cross_fade_paintable_parent_class)->on_snapshot (G_TYPE_CHECK_INSTANCE_CAST (self, G4_TYPE_BASE_PAINTABLE, G4BasePaintable), snapshot, width, height);
	if (self->priv->_fade > ((gdouble) 0)) {
		gtk_snapshot_pop (snapshot);
	}
}

gdouble
g4_cross_fade_paintable_get_fade (G4CrossFadePaintable* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_fade;
	return result;
}

void
g4_cross_fade_paintable_set_fade (G4CrossFadePaintable* self,
                                  gdouble value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_fade != value) {
		self->priv->_fade = value;
		g_signal_emit ((G4BasePaintable*) self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_cross_fade_paintable_properties[G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY]);
}

GdkPaintable*
g4_cross_fade_paintable_get_previous (G4CrossFadePaintable* self)
{
	GdkPaintable* result;
	GdkPaintable* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_previous;
	result = _tmp0_;
	return result;
}

void
g4_cross_fade_paintable_set_previous (G4CrossFadePaintable* self,
                                      GdkPaintable* value)
{
	GdkPaintable* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_previous;
	if (_tmp0_ != value) {
		GdkPaintable* _tmp1_;
		_tmp1_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_previous);
		self->priv->_previous = _tmp1_;
		g_signal_emit ((G4BasePaintable*) self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_cross_fade_paintable_properties[G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY]);
}

static void
g4_cross_fade_paintable_class_init (G4CrossFadePaintableClass * klass,
                                    gpointer klass_data)
{
	g4_cross_fade_paintable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4CrossFadePaintable_private_offset);
	((G4BasePaintableClass *) klass)->on_change = (void (*) (G4BasePaintable*, GdkPaintable*, GdkPaintable*)) g4_cross_fade_paintable_real_on_change;
	((G4BasePaintableClass *) klass)->on_snapshot = (void (*) (G4BasePaintable*, GtkSnapshot*, gdouble, gdouble)) g4_cross_fade_paintable_real_on_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_cross_fade_paintable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_cross_fade_paintable_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_cross_fade_paintable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY, g4_cross_fade_paintable_properties[G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY] = g_param_spec_double ("fade", "fade", "fade", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY, g4_cross_fade_paintable_properties[G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY] = g_param_spec_object ("previous", "previous", "previous", gdk_paintable_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
g4_cross_fade_paintable_instance_init (G4CrossFadePaintable * self,
                                       gpointer klass)
{
	self->priv = g4_cross_fade_paintable_get_instance_private (self);
	self->priv->_previous = NULL;
	self->priv->_fade = (gdouble) 0;
}

static void
g4_cross_fade_paintable_finalize (GObject * obj)
{
	G4CrossFadePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintable);
	_g_object_unref0 (self->priv->_previous);
	G_OBJECT_CLASS (g4_cross_fade_paintable_parent_class)->finalize (obj);
}

static GType
g4_cross_fade_paintable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4CrossFadePaintableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_cross_fade_paintable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4CrossFadePaintable), 0, (GInstanceInitFunc) g4_cross_fade_paintable_instance_init, NULL };
	GType g4_cross_fade_paintable_type_id;
	g4_cross_fade_paintable_type_id = g_type_register_static (G4_TYPE_BASE_PAINTABLE, "G4CrossFadePaintable", &g_define_type_info, 0);
	G4CrossFadePaintable_private_offset = g_type_add_instance_private (g4_cross_fade_paintable_type_id, sizeof (G4CrossFadePaintablePrivate));
	return g4_cross_fade_paintable_type_id;
}

GType
g4_cross_fade_paintable_get_type (void)
{
	static volatile gsize g4_cross_fade_paintable_type_id__once = 0;
	if (g_once_init_enter (&g4_cross_fade_paintable_type_id__once)) {
		GType g4_cross_fade_paintable_type_id;
		g4_cross_fade_paintable_type_id = g4_cross_fade_paintable_get_type_once ();
		g_once_init_leave (&g4_cross_fade_paintable_type_id__once, g4_cross_fade_paintable_type_id);
	}
	return g4_cross_fade_paintable_type_id__once;
}

static void
_vala_g4_cross_fade_paintable_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	G4CrossFadePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintable);
	switch (property_id) {
		case G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY:
		g_value_set_double (value, g4_cross_fade_paintable_get_fade (self));
		break;
		case G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY:
		g_value_set_object (value, g4_cross_fade_paintable_get_previous (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_cross_fade_paintable_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	G4CrossFadePaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_CROSS_FADE_PAINTABLE, G4CrossFadePaintable);
	switch (property_id) {
		case G4_CROSS_FADE_PAINTABLE_FADE_PROPERTY:
		g4_cross_fade_paintable_set_fade (self, g_value_get_double (value));
		break;
		case G4_CROSS_FADE_PAINTABLE_PREVIOUS_PROPERTY:
		g4_cross_fade_paintable_set_previous (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
g4_matrix_paintable_get_instance_private (G4MatrixPaintable* self)
{
	return G_STRUCT_MEMBER_P (self, G4MatrixPaintable_private_offset);
}

G4MatrixPaintable*
g4_matrix_paintable_construct (GType object_type,
                               GdkPaintable* paintable)
{
	G4MatrixPaintable * self = NULL;
	self = (G4MatrixPaintable*) g4_base_paintable_construct (object_type, paintable);
	return self;
}

G4MatrixPaintable*
g4_matrix_paintable_new (GdkPaintable* paintable)
{
	return g4_matrix_paintable_construct (G4_TYPE_MATRIX_PAINTABLE, paintable);
}

static void
g4_matrix_paintable_real_on_snapshot (G4BasePaintable* base,
                                      GtkSnapshot* snapshot,
                                      gdouble width,
                                      gdouble height)
{
	G4MatrixPaintable * self;
	gboolean _tmp0_ = FALSE;
	gboolean saved = FALSE;
	self = (G4MatrixPaintable*) base;
	g_return_if_fail (snapshot != NULL);
	if (self->priv->_rotation != ((gdouble) 0)) {
		_tmp0_ = TRUE;
	} else {
		_tmp0_ = self->priv->_scale != ((gdouble) 1);
	}
	saved = _tmp0_;
	if (saved) {
		gtk_snapshot_save (snapshot);
		g4_compute_matrix (snapshot, width, height, self->priv->_rotation, self->priv->_scale);
	}
	G4_BASE_PAINTABLE_CLASS (g4_matrix_paintable_parent_class)->on_snapshot (G_TYPE_CHECK_INSTANCE_CAST (self, G4_TYPE_BASE_PAINTABLE, G4BasePaintable), snapshot, width, height);
	if (saved) {
		gtk_snapshot_restore (snapshot);
	}
}

gdouble
g4_matrix_paintable_get_rotation (G4MatrixPaintable* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_rotation;
	return result;
}

void
g4_matrix_paintable_set_rotation (G4MatrixPaintable* self,
                                  gdouble value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_rotation != value) {
		self->priv->_rotation = value;
		g_signal_emit ((G4BasePaintable*) self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_matrix_paintable_properties[G4_MATRIX_PAINTABLE_ROTATION_PROPERTY]);
}

gdouble
g4_matrix_paintable_get_scale (G4MatrixPaintable* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_scale;
	return result;
}

void
g4_matrix_paintable_set_scale (G4MatrixPaintable* self,
                               gdouble value)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_scale != value) {
		self->priv->_scale = value;
		g_signal_emit ((G4BasePaintable*) self, g4_base_paintable_signals[G4_BASE_PAINTABLE_QUEUE_DRAW_SIGNAL], 0);
	}
	g_object_notify_by_pspec ((GObject *) self, g4_matrix_paintable_properties[G4_MATRIX_PAINTABLE_SCALE_PROPERTY]);
}

static void
g4_matrix_paintable_class_init (G4MatrixPaintableClass * klass,
                                gpointer klass_data)
{
	g4_matrix_paintable_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &G4MatrixPaintable_private_offset);
	((G4BasePaintableClass *) klass)->on_snapshot = (void (*) (G4BasePaintable*, GtkSnapshot*, gdouble, gdouble)) g4_matrix_paintable_real_on_snapshot;
	G_OBJECT_CLASS (klass)->get_property = _vala_g4_matrix_paintable_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_g4_matrix_paintable_set_property;
	G_OBJECT_CLASS (klass)->finalize = g4_matrix_paintable_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MATRIX_PAINTABLE_ROTATION_PROPERTY, g4_matrix_paintable_properties[G4_MATRIX_PAINTABLE_ROTATION_PROPERTY] = g_param_spec_double ("rotation", "rotation", "rotation", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), G4_MATRIX_PAINTABLE_SCALE_PROPERTY, g4_matrix_paintable_properties[G4_MATRIX_PAINTABLE_SCALE_PROPERTY] = g_param_spec_double ("scale", "scale", "scale", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
g4_matrix_paintable_instance_init (G4MatrixPaintable * self,
                                   gpointer klass)
{
	self->priv = g4_matrix_paintable_get_instance_private (self);
	self->priv->_rotation = (gdouble) 0;
	self->priv->_scale = (gdouble) 1;
}

static void
g4_matrix_paintable_finalize (GObject * obj)
{
	G4MatrixPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintable);
	G_OBJECT_CLASS (g4_matrix_paintable_parent_class)->finalize (obj);
}

static GType
g4_matrix_paintable_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (G4MatrixPaintableClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) g4_matrix_paintable_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (G4MatrixPaintable), 0, (GInstanceInitFunc) g4_matrix_paintable_instance_init, NULL };
	GType g4_matrix_paintable_type_id;
	g4_matrix_paintable_type_id = g_type_register_static (G4_TYPE_BASE_PAINTABLE, "G4MatrixPaintable", &g_define_type_info, 0);
	G4MatrixPaintable_private_offset = g_type_add_instance_private (g4_matrix_paintable_type_id, sizeof (G4MatrixPaintablePrivate));
	return g4_matrix_paintable_type_id;
}

GType
g4_matrix_paintable_get_type (void)
{
	static volatile gsize g4_matrix_paintable_type_id__once = 0;
	if (g_once_init_enter (&g4_matrix_paintable_type_id__once)) {
		GType g4_matrix_paintable_type_id;
		g4_matrix_paintable_type_id = g4_matrix_paintable_get_type_once ();
		g_once_init_leave (&g4_matrix_paintable_type_id__once, g4_matrix_paintable_type_id);
	}
	return g4_matrix_paintable_type_id__once;
}

static void
_vala_g4_matrix_paintable_get_property (GObject * object,
                                        guint property_id,
                                        GValue * value,
                                        GParamSpec * pspec)
{
	G4MatrixPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintable);
	switch (property_id) {
		case G4_MATRIX_PAINTABLE_ROTATION_PROPERTY:
		g_value_set_double (value, g4_matrix_paintable_get_rotation (self));
		break;
		case G4_MATRIX_PAINTABLE_SCALE_PROPERTY:
		g_value_set_double (value, g4_matrix_paintable_get_scale (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_g4_matrix_paintable_set_property (GObject * object,
                                        guint property_id,
                                        const GValue * value,
                                        GParamSpec * pspec)
{
	G4MatrixPaintable * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, G4_TYPE_MATRIX_PAINTABLE, G4MatrixPaintable);
	switch (property_id) {
		case G4_MATRIX_PAINTABLE_ROTATION_PROPERTY:
		g4_matrix_paintable_set_rotation (self, g_value_get_double (value));
		break;
		case G4_MATRIX_PAINTABLE_SCALE_PROPERTY:
		g4_matrix_paintable_set_scale (self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

void
g4_compute_matrix (GtkSnapshot* snapshot,
                   gdouble width,
                   gdouble height,
                   gdouble rotation,
                   gdouble scale)
{
	graphene_point_t point = {0};
	graphene_point_t _tmp0_;
	graphene_point_t _tmp1_;
	graphene_point_t _tmp2_;
	graphene_point_t _tmp3_;
	g_return_if_fail (snapshot != NULL);
	memset (&point, 0, sizeof (graphene_point_t));
	graphene_point_init (&point, (gfloat) (width * 0.5), (gfloat) (height * 0.5));
	_tmp0_ = point;
	gtk_snapshot_translate (snapshot, &_tmp0_);
	if (rotation != ((gdouble) 0)) {
		gtk_snapshot_rotate (snapshot, (gfloat) rotation);
	}
	if (scale != ((gdouble) 1)) {
		gtk_snapshot_scale (snapshot, (gfloat) scale, (gfloat) scale);
	}
	_tmp1_ = point;
	_tmp2_ = point;
	graphene_point_init (&point, -_tmp1_.x, -_tmp2_.y);
	_tmp3_ = point;
	gtk_snapshot_translate (snapshot, &_tmp3_);
}

void
g4_color_from_uint (guint color,
                    GdkRGBA* result)
{
	GdkRGBA c = {0};
	memset (&c, 0, sizeof (GdkRGBA));
	c.alpha = ((color >> 24) & 0xff) / 255.f;
	c.red = ((color >> 16) & 0xff) / 255.f;
	c.green = ((color >> 8) & 0xff) / 255.f;
	c.blue = (color & 0xff) / 255.f;
	*result = c;
	return;
}

GdkPaintable*
g4_create_blur_paintable (GtkWidget* widget,
                          GdkPaintable* paintable,
                          gint size,
                          gdouble blur,
                          gdouble opacity)
{
	GtkSnapshot* snapshot = NULL;
	GtkSnapshot* _tmp0_;
	GtkSnapshot* _tmp1_;
	GtkSnapshot* _tmp2_;
	GtkSnapshot* _tmp3_;
	GtkSnapshot* _tmp4_;
	GtkSnapshot* _tmp5_;
	graphene_rect_t rect = {0};
	GdkPaintable* _result_ = NULL;
	GskRenderNode* node = NULL;
	GtkSnapshot* _tmp6_;
	GtkSnapshot* _tmp7_;
	GskRenderNode* _tmp8_;
	GskRenderNode* _tmp9_;
	GdkPaintable* _tmp20_ = NULL;
	GdkPaintable* _tmp21_;
	GdkPaintable* _tmp22_;
	GdkPaintable* _tmp28_;
	GdkPaintable* result;
	g_return_val_if_fail (widget != NULL, NULL);
	g_return_val_if_fail (paintable != NULL, NULL);
	_tmp0_ = gtk_snapshot_new ();
	snapshot = _tmp0_;
	_tmp1_ = snapshot;
	gtk_snapshot_push_opacity (_tmp1_, opacity);
	_tmp2_ = snapshot;
	gtk_snapshot_push_blur (_tmp2_, blur);
	_tmp3_ = snapshot;
	gdk_paintable_snapshot (paintable, (GdkSnapshot*) _tmp3_, (gdouble) size, (gdouble) size);
	_tmp4_ = snapshot;
	gtk_snapshot_pop (_tmp4_);
	_tmp5_ = snapshot;
	gtk_snapshot_pop (_tmp5_);
	memset (&rect, 0, sizeof (graphene_rect_t));
	graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) size, (gfloat) size);
	_result_ = NULL;
	_tmp6_ = snapshot;
	_tmp7_ = _g_object_ref0 (_tmp6_);
	_tmp8_ = gtk_snapshot_free_to_node (_tmp7_);
	node = _tmp8_;
	_tmp9_ = node;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp9_, gsk_render_node_get_type ())) {
		GtkNative* _tmp10_ = NULL;
		GtkNative* _tmp11_;
		GskRenderer* _tmp12_ = NULL;
		GskRenderer* _tmp14_ = NULL;
		GdkTexture* _tmp15_ = NULL;
		GdkTexture* _tmp19_;
		_tmp11_ = gtk_widget_get_native (widget);
		_tmp10_ = _tmp11_;
		_tmp12_ = NULL;
		if (_tmp10_ != NULL) {
			GskRenderer* _tmp13_;
			_tmp13_ = gtk_native_get_renderer (G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, gtk_native_get_type (), GtkNative));
			_tmp12_ = _tmp13_;
		}
		_tmp14_ = _tmp12_;
		_tmp15_ = NULL;
		if (_tmp14_ != NULL) {
			GskRenderNode* _tmp16_;
			graphene_rect_t _tmp17_;
			GdkTexture* _tmp18_;
			_tmp16_ = node;
			_tmp17_ = rect;
			_tmp18_ = gsk_renderer_render_texture (G_TYPE_CHECK_INSTANCE_CAST (_tmp14_, gsk_renderer_get_type (), GskRenderer), G_TYPE_CHECK_INSTANCE_CAST (_tmp16_, gsk_render_node_get_type (), GskRenderNode), &_tmp17_);
			_g_object_unref0 (_tmp15_);
			_tmp15_ = _tmp18_;
		}
		_tmp19_ = _tmp15_;
		_tmp15_ = NULL;
		_g_object_unref0 (_result_);
		_result_ = (GdkPaintable*) _tmp19_;
		_g_object_unref0 (_tmp15_);
	}
	_tmp21_ = _result_;
	_tmp22_ = _g_object_ref0 (_tmp21_);
	_tmp20_ = _tmp22_;
	if (_tmp20_ == NULL) {
		GtkSnapshot* _tmp23_;
		GtkSnapshot* _tmp24_;
		graphene_rect_t _tmp25_;
		graphene_size_t _tmp26_;
		GdkPaintable* _tmp27_;
		_tmp23_ = snapshot;
		_tmp24_ = _g_object_ref0 (_tmp23_);
		_tmp25_ = rect;
		_tmp26_ = _tmp25_.size;
		_tmp27_ = gtk_snapshot_free_to_paintable (_tmp24_, &_tmp26_);
		_g_object_unref0 (_tmp20_);
		_tmp20_ = _tmp27_;
	}
	_tmp28_ = _tmp20_;
	_tmp20_ = NULL;
	result = _tmp28_;
	_g_object_unref0 (_tmp20_);
	_gsk_render_node_unref0 (node);
	_g_object_unref0 (_result_);
	_g_object_unref0 (snapshot);
	return result;
}

static void
_vala_PangoFontDescription_free (PangoFontDescription* self)
{
	g_boxed_free (pango_font_description_get_type (), self);
}

PangoLayout*
g4_create_center_text_layout (PangoContext* context,
                              const gchar* family,
                              gint width,
                              gint height,
                              gdouble font_size)
{
	PangoFontDescription* font = NULL;
	PangoFontDescription* _tmp0_;
	PangoLayout* layout = NULL;
	PangoLayout* _tmp1_;
	PangoLayout* result;
	g_return_val_if_fail (context != NULL, NULL);
	g_return_val_if_fail (family != NULL, NULL);
	_tmp0_ = pango_font_description_new ();
	font = _tmp0_;
	pango_font_description_set_absolute_size (font, font_size * PANGO_SCALE);
	pango_font_description_set_family (font, family);
	pango_font_description_set_weight (font, PANGO_WEIGHT_BOLD);
	_tmp1_ = pango_layout_new (context);
	layout = _tmp1_;
	pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
	pango_layout_set_font_description (layout, font);
	pango_layout_set_width (layout, width * PANGO_SCALE);
	pango_layout_set_height (layout, height * PANGO_SCALE);
	pango_layout_set_single_paragraph_mode (layout, TRUE);
	result = layout;
	__vala_PangoFontDescription_free0 (font);
	return result;
}

GdkPaintable*
g4_create_text_paintable (PangoContext* context,
                          const gchar* text,
                          gint width,
                          gint height,
                          guint color_index)
{
	GtkSnapshot* snapshot = NULL;
	GtkSnapshot* _tmp0_;
	graphene_rect_t rect = {0};
	GdkRGBA c = {0};
	PangoRectangle ink_rect = {0};
	PangoRectangle logic_rect = {0};
	PangoLayout* layout = NULL;
	PangoLayout* _tmp17_;
	gint _tmp18_;
	gint _tmp19_;
	PangoRectangle _tmp20_ = {0};
	PangoRectangle _tmp21_ = {0};
	graphene_point_t pt = {0};
	PangoRectangle _tmp22_;
	PangoRectangle _tmp23_;
	GtkSnapshot* _tmp24_;
	graphene_point_t _tmp25_;
	GtkSnapshot* _tmp26_;
	GdkRGBA _tmp27_;
	graphene_point_t _tmp28_;
	GtkSnapshot* _tmp29_;
	graphene_point_t _tmp30_;
	GtkSnapshot* _tmp31_;
	GtkSnapshot* _tmp32_;
	graphene_rect_t _tmp33_;
	graphene_size_t _tmp34_;
	GdkPaintable* _tmp35_;
	GdkPaintable* result;
	g_return_val_if_fail (context != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	_tmp0_ = gtk_snapshot_new ();
	snapshot = _tmp0_;
	memset (&rect, 0, sizeof (graphene_rect_t));
	graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) width, (gfloat) height);
	memset (&c, 0, sizeof (GdkRGBA));
	c.alpha = 1.f;
	if (color_index < ((guint) (G_N_ELEMENTS (G4_BACKGROUND_COLORS) / 2))) {
		GdkRGBA c1 = {0};
		guint32 _tmp1_;
		GdkRGBA _tmp2_ = {0};
		GdkRGBA c2 = {0};
		guint32 _tmp3_;
		GdkRGBA _tmp4_ = {0};
		GskColorStop* stops = NULL;
		GdkRGBA _tmp5_;
		GskColorStop _tmp6_ = {0};
		GdkRGBA _tmp7_;
		GskColorStop _tmp8_ = {0};
		GdkRGBA _tmp9_;
		GskColorStop _tmp10_ = {0};
		GskColorStop* _tmp11_;
		gint stops_length1;
		gint _stops_size_;
		GtkSnapshot* _tmp12_;
		graphene_rect_t _tmp13_;
		graphene_point_t _tmp14_ = {0};
		graphene_point_t _tmp15_ = {0};
		GskColorStop* _tmp16_;
		gint _tmp16__length1;
		c.blue = 0.9f;
		c.green = c.blue;
		c.red = c.green;
		_tmp1_ = G4_BACKGROUND_COLORS[color_index * 2];
		g4_color_from_uint ((guint) _tmp1_, &_tmp2_);
		c1 = _tmp2_;
		_tmp3_ = G4_BACKGROUND_COLORS[(color_index * 2) + 1];
		g4_color_from_uint ((guint) _tmp3_, &_tmp4_);
		c2 = _tmp4_;
		_tmp5_ = c1;
		memset (&_tmp6_, 0, sizeof (GskColorStop));
		_tmp6_.offset = (gfloat) 0;
		_tmp6_.color = _tmp5_;
		_tmp7_ = c2;
		memset (&_tmp8_, 0, sizeof (GskColorStop));
		_tmp8_.offset = 0.5f;
		_tmp8_.color = _tmp7_;
		_tmp9_ = c1;
		memset (&_tmp10_, 0, sizeof (GskColorStop));
		_tmp10_.offset = (gfloat) 1;
		_tmp10_.color = _tmp9_;
		_tmp11_ = g_new0 (GskColorStop, 3);
		_tmp11_[0] = _tmp6_;
		_tmp11_[1] = _tmp8_;
		_tmp11_[2] = _tmp10_;
		stops = _tmp11_;
		stops_length1 = 3;
		_stops_size_ = stops_length1;
		_tmp12_ = snapshot;
		_tmp13_ = rect;
		graphene_rect_get_top_left (&rect, &_tmp14_);
		graphene_rect_get_bottom_right (&rect, &_tmp15_);
		_tmp16_ = stops;
		_tmp16__length1 = stops_length1;
		gtk_snapshot_append_linear_gradient (_tmp12_, &_tmp13_, &_tmp14_, &_tmp15_, _tmp16_, (gsize) _tmp16__length1);
		stops = (g_free (stops), NULL);
	} else {
		c.blue = 0.5f;
		c.green = c.blue;
		c.red = c.green;
	}
	memset (&ink_rect, 0, sizeof (PangoRectangle));
	memset (&logic_rect, 0, sizeof (PangoRectangle));
	_tmp17_ = g4_create_center_text_layout (context, "Serif", width, height, height * 0.4);
	layout = _tmp17_;
	_tmp18_ = strlen (text);
	_tmp19_ = _tmp18_;
	pango_layout_set_text (layout, text, _tmp19_);
	pango_layout_get_pixel_extents (layout, &_tmp20_, &_tmp21_);
	ink_rect = _tmp20_;
	logic_rect = _tmp21_;
	memset (&pt, 0, sizeof (graphene_point_t));
	pt.x = (gfloat) 0;
	_tmp22_ = ink_rect;
	_tmp23_ = ink_rect;
	pt.y = (-_tmp22_.y) + ((height - _tmp23_.height) * 0.5f);
	_tmp24_ = snapshot;
	_tmp25_ = pt;
	gtk_snapshot_translate (_tmp24_, &_tmp25_);
	_tmp26_ = snapshot;
	_tmp27_ = c;
	gtk_snapshot_append_layout (_tmp26_, layout, &_tmp27_);
	_tmp28_ = pt;
	pt.y = -_tmp28_.y;
	_tmp29_ = snapshot;
	_tmp30_ = pt;
	gtk_snapshot_translate (_tmp29_, &_tmp30_);
	_tmp31_ = snapshot;
	_tmp32_ = _g_object_ref0 (_tmp31_);
	_tmp33_ = rect;
	_tmp34_ = _tmp33_.size;
	_tmp35_ = gtk_snapshot_free_to_paintable (_tmp32_, &_tmp34_);
	result = _tmp35_;
	_g_object_unref0 (layout);
	_g_object_unref0 (snapshot);
	return result;
}

gchar*
g4_create_text_svg (PangoContext* context,
                    const gchar* text,
                    guint color_index)
{
	graphene_rect_t rect = {0};
	gint width = 0;
	gint height = 0;
	guint c1 = 0U;
	guint c2 = 0U;
	PangoRectangle ink_rect = {0};
	PangoRectangle logic_rect = {0};
	PangoLayout* layout = NULL;
	PangoLayout* _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	PangoRectangle _tmp5_ = {0};
	PangoRectangle _tmp6_ = {0};
	gfloat x = 0.0F;
	PangoRectangle _tmp7_;
	gfloat y = 0.0F;
	PangoRectangle _tmp8_;
	PangoRectangle _tmp9_;
	const gchar* _tmp10_;
	gchar* _tmp11_;
	gchar* result;
	g_return_val_if_fail (context != NULL, NULL);
	g_return_val_if_fail (text != NULL, NULL);
	memset (&rect, 0, sizeof (graphene_rect_t));
	width = 128;
	height = 128;
	graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) width, (gfloat) height);
	c1 = (guint) 0;
	c2 = (guint) 0;
	if (color_index < ((guint) (G_N_ELEMENTS (G4_BACKGROUND_COLORS) / 2))) {
		guint32 _tmp0_;
		guint32 _tmp1_;
		_tmp0_ = G4_BACKGROUND_COLORS[color_index * 2];
		c1 = (guint) (_tmp0_ & 0x00ffffffU);
		_tmp1_ = G4_BACKGROUND_COLORS[(color_index * 2) + 1];
		c2 = (guint) (_tmp1_ & 0x00ffffffU);
	}
	memset (&ink_rect, 0, sizeof (PangoRectangle));
	memset (&logic_rect, 0, sizeof (PangoRectangle));
	_tmp2_ = g4_create_center_text_layout (context, "Serif", width, height, height * 0.4);
	layout = _tmp2_;
	_tmp3_ = strlen (text);
	_tmp4_ = _tmp3_;
	pango_layout_set_text (layout, text, _tmp4_);
	pango_layout_get_pixel_extents (layout, &_tmp5_, &_tmp6_);
	ink_rect = _tmp5_;
	logic_rect = _tmp6_;
	_tmp7_ = logic_rect;
	x = (width - _tmp7_.width) * 0.5f;
	_tmp8_ = ink_rect;
	_tmp9_ = logic_rect;
	y = (-_tmp8_.y) + ((height + _tmp9_.height) * 0.5f);
	_tmp10_ = g4_TEXT_SVG_FORMAT;
	_tmp11_ = g_strdup_printf (_tmp10_, c1, c2, c1, x, y, text);
	result = _tmp11_;
	_g_object_unref0 (layout);
	return result;
}

GdkPaintable*
g4_create_widget_paintable (GtkWidget* widget,
                            graphene_point_t* point,
                            const gchar* title,
                            gint max_size)
{
	gfloat width = 0.0F;
	gfloat height = 0.0F;
	gfloat _tmp0_ = 0.0F;
	gboolean _tmp1_ = FALSE;
	gfloat scale = 0.0F;
	GtkWidgetPaintable* paintable = NULL;
	GtkWidgetPaintable* _tmp2_;
	GtkSnapshot* snapshot = NULL;
	GtkSnapshot* _tmp3_;
	GtkSnapshot* _tmp63_;
	GtkSnapshot* _tmp64_;
	GdkPaintable* _tmp65_;
	GdkPaintable* result;
	g_return_val_if_fail (widget != NULL, NULL);
	g_return_val_if_fail (point != NULL, NULL);
	width = (gfloat) gtk_widget_get_width (widget);
	height = (gfloat) gtk_widget_get_height (widget);
	if (width > ((gfloat) max_size)) {
		_tmp1_ = TRUE;
	} else {
		_tmp1_ = height > ((gfloat) max_size);
	}
	if (_tmp1_) {
		_tmp0_ = max_size / MAX (width, height);
	} else {
		_tmp0_ = (gfloat) 1;
	}
	scale = _tmp0_;
	width *= scale;
	height *= scale;
	(*point).x = (*point).x * scale;
	(*point).y = (*point).y * scale;
	_tmp2_ = (GtkWidgetPaintable*) gtk_widget_paintable_new (widget);
	paintable = _tmp2_;
	_tmp3_ = gtk_snapshot_new ();
	snapshot = _tmp3_;
	if (title != NULL) {
		gchar* text = NULL;
		gchar* _tmp4_;
		PangoRectangle ink_rect = {0};
		PangoRectangle logic_rect = {0};
		PangoLayout* layout = NULL;
		PangoContext* _tmp5_;
		PangoLayout* _tmp6_;
		PangoLayout* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		PangoLayout* _tmp12_;
		PangoRectangle _tmp13_ = {0};
		PangoRectangle _tmp14_ = {0};
		graphene_point_t pt = {0};
		PangoRectangle _tmp15_;
		graphene_point_t _tmp16_;
		GtkSnapshot* _tmp17_;
		graphene_point_t _tmp18_;
		GtkSnapshot* _tmp19_;
		GtkWidgetPaintable* _tmp20_;
		GtkSnapshot* _tmp21_;
		GtkSnapshot* _tmp22_;
		graphene_point_t _tmp23_;
		GtkSnapshot* _tmp24_;
		graphene_point_t _tmp25_;
		PangoRectangle _tmp26_;
		PangoRectangle _tmp27_;
		GtkSnapshot* _tmp28_;
		graphene_point_t _tmp29_;
		graphene_rect_t rect = {0};
		PangoRectangle _tmp30_;
		PangoRectangle _tmp31_;
		PangoRectangle _tmp32_;
		graphene_rect_t _tmp33_;
		graphene_size_t _tmp34_;
		GskRoundedRect bounds = {0};
		gfloat radius = 0.0F;
		graphene_rect_t _tmp35_;
		graphene_size_t _tmp36_;
		graphene_rect_t _tmp37_;
		GtkSnapshot* _tmp38_;
		GskRoundedRect _tmp39_;
		GdkRGBA color = {0};
		AdwStyleManager* _tmp40_;
		AdwAccentColor _tmp41_;
		AdwAccentColor _tmp42_;
		GdkRGBA _tmp43_ = {0};
		GtkSnapshot* _tmp44_;
		GdkRGBA _tmp45_;
		graphene_rect_t _tmp46_;
		PangoRectangle _tmp47_;
		PangoRectangle _tmp48_;
		PangoRectangle _tmp49_;
		GtkSnapshot* _tmp50_;
		graphene_point_t _tmp51_;
		GtkSnapshot* _tmp52_;
		PangoLayout* _tmp53_;
		GdkRGBA _tmp54_;
		GtkSnapshot* _tmp55_;
		GtkSnapshot* _tmp56_;
		GskRoundedRect _tmp57_;
		GdkRGBA _tmp58_;
		_tmp4_ = g_strdup ((const gchar*) title);
		text = _tmp4_;
		memset (&ink_rect, 0, sizeof (PangoRectangle));
		memset (&logic_rect, 0, sizeof (PangoRectangle));
		_tmp5_ = gtk_widget_get_pango_context (widget);
		_tmp6_ = g4_create_center_text_layout (_tmp5_, "Sans", (gint) width, (gint) height, height * 0.2);
		layout = _tmp6_;
		_tmp7_ = layout;
		_tmp8_ = text;
		_tmp9_ = text;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		pango_layout_set_text (_tmp7_, _tmp8_, _tmp11_);
		_tmp12_ = layout;
		pango_layout_get_pixel_extents (_tmp12_, &_tmp13_, &_tmp14_);
		ink_rect = _tmp13_;
		logic_rect = _tmp14_;
		memset (&pt, 0, sizeof (graphene_point_t));
		pt.x = (gfloat) 0;
		_tmp15_ = logic_rect;
		pt.y = _tmp15_.height * 0.5f;
		_tmp16_ = pt;
		(*point).y = (*point).y + _tmp16_.y;
		_tmp17_ = snapshot;
		_tmp18_ = pt;
		gtk_snapshot_translate (_tmp17_, &_tmp18_);
		_tmp19_ = snapshot;
		gtk_snapshot_scale (_tmp19_, scale, scale);
		_tmp20_ = paintable;
		_tmp21_ = snapshot;
		gdk_paintable_snapshot ((GdkPaintable*) _tmp20_, (GdkSnapshot*) _tmp21_, (gdouble) gtk_widget_get_width (widget), (gdouble) gtk_widget_get_height (widget));
		_tmp22_ = snapshot;
		gtk_snapshot_scale (_tmp22_, 1 / scale, 1 / scale);
		_tmp23_ = pt;
		pt.y = -_tmp23_.y;
		_tmp24_ = snapshot;
		_tmp25_ = pt;
		gtk_snapshot_translate (_tmp24_, &_tmp25_);
		_tmp26_ = ink_rect;
		_tmp27_ = logic_rect;
		pt.x = (width - _tmp26_.x) - (_tmp27_.width * 0.5f);
		pt.y = (gfloat) 2;
		_tmp28_ = snapshot;
		_tmp29_ = pt;
		gtk_snapshot_translate (_tmp28_, &_tmp29_);
		memset (&rect, 0, sizeof (graphene_rect_t));
		_tmp30_ = logic_rect;
		_tmp31_ = logic_rect;
		_tmp32_ = logic_rect;
		graphene_rect_init (&rect, (gfloat) 0, (gfloat) 0, (gfloat) MAX (_tmp30_.width, _tmp31_.height), (gfloat) _tmp32_.height);
		_tmp33_ = rect;
		_tmp34_ = _tmp33_.size;
		graphene_rect_offset (&rect, (width - _tmp34_.width) * 0.5f, (gfloat) 0);
		graphene_rect_inset (&rect, (gfloat) -2, (gfloat) -2);
		memset (&bounds, 0, sizeof (GskRoundedRect));
		_tmp35_ = rect;
		_tmp36_ = _tmp35_.size;
		radius = _tmp36_.height * 0.5f;
		_tmp37_ = rect;
		gsk_rounded_rect_init_from_rect (&bounds, &_tmp37_, radius);
		_tmp38_ = snapshot;
		_tmp39_ = bounds;
		gtk_snapshot_push_rounded_clip (_tmp38_, &_tmp39_);
		_tmp40_ = adw_style_manager_get_default ();
		_tmp41_ = adw_style_manager_get_accent_color (_tmp40_);
		_tmp42_ = _tmp41_;
		adw_accent_color_to_rgba (_tmp42_, &_tmp43_);
		color = _tmp43_;
		_tmp44_ = snapshot;
		_tmp45_ = color;
		_tmp46_ = rect;
		gtk_snapshot_append_color (_tmp44_, &_tmp45_, &_tmp46_);
		color.blue = (gfloat) 1;
		color.green = color.blue;
		color.red = color.green;
		pt.x = (gfloat) 0;
		_tmp47_ = ink_rect;
		_tmp48_ = logic_rect;
		_tmp49_ = ink_rect;
		pt.y = (-_tmp47_.y) + ((_tmp48_.height - _tmp49_.height) * 0.5f);
		_tmp50_ = snapshot;
		_tmp51_ = pt;
		gtk_snapshot_translate (_tmp50_, &_tmp51_);
		_tmp52_ = snapshot;
		_tmp53_ = layout;
		_tmp54_ = color;
		gtk_snapshot_append_layout (_tmp52_, _tmp53_, &_tmp54_);
		_tmp55_ = snapshot;
		gtk_snapshot_pop (_tmp55_);
		color.alpha = 0.2f;
		color.blue = (gfloat) 0;
		color.green = color.blue;
		color.red = color.green;
		_tmp56_ = snapshot;
		_tmp57_ = bounds;
		_tmp58_ = color;
		gtk_snapshot_append_outset_shadow (_tmp56_, &_tmp57_, &_tmp58_, (gfloat) 1, (gfloat) 1, (gfloat) 1, (gfloat) 5);
		_g_object_unref0 (layout);
		_g_free0 (text);
	} else {
		GtkSnapshot* _tmp59_;
		GtkWidgetPaintable* _tmp60_;
		GtkSnapshot* _tmp61_;
		GtkSnapshot* _tmp62_;
		_tmp59_ = snapshot;
		gtk_snapshot_scale (_tmp59_, scale, scale);
		_tmp60_ = paintable;
		_tmp61_ = snapshot;
		gdk_paintable_snapshot ((GdkPaintable*) _tmp60_, (GdkSnapshot*) _tmp61_, (gdouble) gtk_widget_get_width (widget), (gdouble) gtk_widget_get_height (widget));
		_tmp62_ = snapshot;
		gtk_snapshot_scale (_tmp62_, 1 / scale, 1 / scale);
	}
	_tmp63_ = snapshot;
	_tmp64_ = _g_object_ref0 (_tmp63_);
	_tmp65_ = gtk_snapshot_free_to_paintable (_tmp64_, NULL);
	result = _tmp65_;
	_g_object_unref0 (snapshot);
	_g_object_unref0 (paintable);
	return result;
}

void
g4_draw_outset_shadow (GtkSnapshot* snapshot,
                       graphene_rect_t* rect,
                       gfloat radius)
{
	graphene_rect_t bounds = {0};
	graphene_rect_t _tmp0_;
	GskRoundedRect outline = {0};
	graphene_rect_t _tmp1_;
	AdwStyleManager* style = NULL;
	AdwStyleManager* _tmp2_;
	AdwStyleManager* _tmp3_;
	AdwStyleManager* _tmp4_;
	gboolean _tmp5_;
	gboolean _tmp6_;
	g_return_if_fail (snapshot != NULL);
	g_return_if_fail (rect != NULL);
	_tmp0_ = *rect;
	bounds = _tmp0_;
	graphene_rect_inset (&bounds, radius, radius);
	memset (&outline, 0, sizeof (GskRoundedRect));
	_tmp1_ = bounds;
	gsk_rounded_rect_init_from_rect (&outline, &_tmp1_, radius);
	_tmp2_ = adw_style_manager_get_default ();
	_tmp3_ = _g_object_ref0 (_tmp2_);
	style = _tmp3_;
	_tmp4_ = style;
	_tmp5_ = adw_style_manager_get_high_contrast (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_) {
		GdkRGBA color = {0};
		gint _tmp7_ = 0;
		AdwStyleManager* _tmp8_;
		gboolean _tmp9_;
		gboolean _tmp10_;
		gfloat* border_width = NULL;
		gfloat* _tmp11_;
		gint border_width_length1;
		gint _border_width_size_;
		GdkRGBA* border_color = NULL;
		GdkRGBA _tmp12_;
		GdkRGBA _tmp13_;
		GdkRGBA _tmp14_;
		GdkRGBA _tmp15_;
		GdkRGBA* _tmp16_;
		gint border_color_length1;
		gint _border_color_size_;
		GskRoundedRect _tmp17_;
		gfloat* _tmp18_;
		gint _tmp18__length1;
		GdkRGBA* _tmp19_;
		gint _tmp19__length1;
		memset (&color, 0, sizeof (GdkRGBA));
		color.alpha = 0.5f;
		_tmp8_ = style;
		_tmp9_ = adw_style_manager_get_dark (_tmp8_);
		_tmp10_ = _tmp9_;
		if (_tmp10_) {
			_tmp7_ = 1;
		} else {
			_tmp7_ = 0;
		}
		color.blue = (gfloat) _tmp7_;
		color.green = color.blue;
		color.red = color.green;
		_tmp11_ = g_new0 (gfloat, 4);
		_tmp11_[0] = (gfloat) 1;
		_tmp11_[1] = (gfloat) 1;
		_tmp11_[2] = (gfloat) 1;
		_tmp11_[3] = (gfloat) 1;
		border_width = _tmp11_;
		border_width_length1 = 4;
		_border_width_size_ = border_width_length1;
		_tmp12_ = color;
		_tmp13_ = color;
		_tmp14_ = color;
		_tmp15_ = color;
		_tmp16_ = g_new0 (GdkRGBA, 4);
		_tmp16_[0] = _tmp12_;
		_tmp16_[1] = _tmp13_;
		_tmp16_[2] = _tmp14_;
		_tmp16_[3] = _tmp15_;
		border_color = _tmp16_;
		border_color_length1 = 4;
		_border_color_size_ = border_color_length1;
		_tmp17_ = outline;
		_tmp18_ = border_width;
		_tmp18__length1 = border_width_length1;
		_tmp19_ = border_color;
		_tmp19__length1 = border_color_length1;
		gtk_snapshot_append_border (snapshot, &_tmp17_, _tmp18_, _tmp19_);
		border_color = (g_free (border_color), NULL);
		border_width = (g_free (border_width), NULL);
	} else {
		GdkRGBA color = {0};
		GskRoundedRect _tmp20_;
		GdkRGBA _tmp21_;
		memset (&color, 0, sizeof (GdkRGBA));
		color.alpha = 0.2f;
		color.blue = (gfloat) 0;
		color.green = color.blue;
		color.red = color.green;
		_tmp20_ = outline;
		_tmp21_ = color;
		gtk_snapshot_append_outset_shadow (snapshot, &_tmp20_, &_tmp21_, (gfloat) 1, (gfloat) 1, (gfloat) 1, MAX (radius - 1, (gfloat) 0));
	}
	_g_object_unref0 (style);
}

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;
}

