/*
 * This file was generated automatically by ExtUtils::ParseXS version 3.51 from the
 * contents of Cairo.xs. Do not edit this file, edit Cairo.xs instead.
 *
 *    ANY CHANGES MADE HERE WILL BE LOST!
 *
 */

#line 1 "Cairo.xs"
/*
 * Copyright (c) 2004-2013 by the cairo perl team (see the file README)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Id$
 *
 */

#include <cairo-perl.h>
#include <cairo-perl-private.h>

#define NEED_newRV_noinc_GLOBAL
#include "ppport.h"

/* ------------------------------------------------------------------------- */

static void
call_xs (pTHX_ void (*subaddr) (pTHX_ CV *), CV * cv, SV ** mark)
{
	dSP;
	PUSHMARK (mark);
	(*subaddr) (aTHX_ cv);
	PUTBACK;	/* forget return values */
}

#ifndef XS_EXTERNAL
# define XS_EXTERNAL(name) XS(name)
#endif
#define CAIRO_PERL_CALL_BOOT(name)				\
	{							\
		extern XS_EXTERNAL (name);			\
		call_xs (aTHX_ name, cv, mark);	\
	}

/* ------------------------------------------------------------------------- */

/* Copied from Glib/Glib.xs. */
void *
cairo_perl_alloc_temp (int nbytes)
{
	dTHR;
	SV * s;

	if (nbytes <= 0) return NULL;

	s = sv_2mortal (NEWSV (0, nbytes));
	memset (SvPVX (s), 0, nbytes);
	return SvPVX (s);
}

/* Copied from Glib/GType.xs. */
void
cairo_perl_set_isa (const char *child_package,
                    const char *parent_package)
{
	char *child_isa_full;
	AV *isa;

	New (0, child_isa_full, strlen(child_package) + 5 + 1, char);
	child_isa_full = strcpy (child_isa_full, child_package);
	child_isa_full = strcat (child_isa_full, "::ISA");
	isa = get_av (child_isa_full, TRUE); /* create on demand */
	Safefree (child_isa_full);

	av_push (isa, newSVpv (parent_package, 0));
}

/* Copied from Glib/Glib.xs. */
cairo_bool_t
cairo_perl_sv_is_defined (SV *sv)
{
	/* This is adapted from PP(pp_defined) in perl's pp.c */

	if (!sv || !SvANY(sv))
		return FALSE;

	switch (SvTYPE(sv)) {
	    case SVt_PVAV:
		if (AvMAX(sv) >= 0 || SvGMAGICAL(sv)
		    || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
			return TRUE;
		break;
	    case SVt_PVHV:
		if (HvARRAY(sv) || SvGMAGICAL(sv)
		    || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
			return TRUE;
		break;
	    case SVt_PVCV:
		if (CvROOT(sv) || CvXSUB(sv))
			return TRUE;
		break;
	    default:
		if (SvGMAGICAL(sv))
			mg_get(sv);
		if (SvOK(sv))
			return TRUE;
	}

	return FALSE;
}

/* ------------------------------------------------------------------------- */

void *
cairo_object_from_sv (SV *sv, const char *package)
{
	if (!cairo_perl_sv_is_ref (sv) || !sv_derived_from (sv, package))
		croak("Cannot convert scalar %p to an object of type %s",
		      sv, package);
	return INT2PTR (void *, SvIV ((SV *) SvRV (sv)));
}

SV *
cairo_object_to_sv (void *object, const char *package)
{
	SV *sv = newSV (0);
	sv_setref_pv(sv, package, object);
	return sv;
}

/* ------------------------------------------------------------------------- */

void *
cairo_struct_from_sv (SV *sv, const char *package)
{
	if (!cairo_perl_sv_is_ref (sv) || !sv_derived_from (sv, package))
		croak("Cannot convert scalar %p to a struct of type %s",
		      sv, package);
	return INT2PTR (void *, SvIV ((SV *) SvRV (sv)));
}

SV *
cairo_struct_to_sv (void *object, const char *package)
{
	SV *sv = newSV (0);
	sv_setref_pv(sv, package, object);
	return sv;
}

/* ------------------------------------------------------------------------- */

SV *
newSVCairoFontExtents (cairo_font_extents_t *extents)
{
	HV *hv;
	double value;

	if (!extents)
		return &PL_sv_undef;

	hv = newHV ();

	value = extents->ascent;
	hv_store (hv, "ascent", 6, newSVnv (value), 0);

	value = extents->descent;
	hv_store (hv, "descent", 7, newSVnv (value), 0);

	value = extents->height;
	hv_store (hv, "height", 6, newSVnv (value), 0);

	value = extents->max_x_advance;
	hv_store (hv, "max_x_advance", 13, newSVnv (value), 0);

	value = extents->max_y_advance;
	hv_store (hv, "max_y_advance", 13, newSVnv (value), 0);

	return newRV_noinc ((SV *) hv);
}

/* ------------------------------------------------------------------------- */

SV *
newSVCairoTextExtents (cairo_text_extents_t *extents)
{
	HV *hv;
	double value;

	if (!extents)
		return &PL_sv_undef;

	hv = newHV ();

	value = extents->x_bearing;
	hv_store (hv, "x_bearing", 9, newSVnv (value), 0);

	value = extents->y_bearing;
	hv_store (hv, "y_bearing", 9, newSVnv (value), 0);

	value = extents->width;
	hv_store (hv, "width", 5, newSVnv (value), 0);

	value = extents->height;
	hv_store (hv, "height", 6, newSVnv (value), 0);

	value = extents->x_advance;
	hv_store (hv, "x_advance", 9, newSVnv (value), 0);

	value = extents->y_advance;
	hv_store (hv, "y_advance", 9, newSVnv (value), 0);

	return newRV_noinc ((SV *) hv);
}

/* ------------------------------------------------------------------------- */

SV *
newSVCairoGlyph (cairo_glyph_t *glyph)
{
	HV *hv;
	unsigned long index;
	double value;

	if (!glyph)
		return &PL_sv_undef;

	hv = newHV ();

	index = glyph->index;
	hv_store (hv, "index", 5, newSVuv (index), 0);

	value = glyph->x;
	hv_store (hv, "x", 1, newSVnv (value), 0);

	value = glyph->y;
	hv_store (hv, "y", 1, newSVnv (value), 0);

	return newRV_noinc ((SV *) hv);
}

cairo_glyph_t *
SvCairoGlyph (SV *sv)
{
	HV *hv;
	SV **value;
	cairo_glyph_t *glyph;

	if (!cairo_perl_sv_is_hash_ref (sv))
		croak ("cairo_glyph_t must be a hash reference");

	hv = (HV *) SvRV (sv);
	glyph = cairo_perl_alloc_temp (sizeof (cairo_glyph_t));

	value = hv_fetch (hv, "index", 5, 0);
	if (value && SvOK (*value))
		glyph->index = SvUV (*value);

	value = hv_fetch (hv, "x", 1, 0);
	if (value && SvOK (*value))
		glyph->x = SvNV (*value);

	value = hv_fetch (hv, "y", 1, 0);
	if (value && SvOK (*value))
		glyph->y = SvNV (*value);

	return glyph;
}

/* ------------------------------------------------------------------------- */

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)

SV *
newSVCairoRectangle (cairo_rectangle_t *rectangle)
{
	HV *hv;

	if (!rectangle)
		return &PL_sv_undef;

	hv = newHV ();

	hv_store (hv, "x", 1, newSVnv (rectangle->x), 0);
	hv_store (hv, "y", 1, newSVnv (rectangle->y), 0);
	hv_store (hv, "width", 5, newSVnv (rectangle->width), 0);
	hv_store (hv, "height", 6, newSVnv (rectangle->height), 0);

	return newRV_noinc ((SV *) hv);
}

cairo_rectangle_t *
SvCairoRectangle (SV *sv)
{
	HV *hv;
	SV **value;
	cairo_rectangle_t *rectangle;

	if (!cairo_perl_sv_is_hash_ref (sv))
		croak ("cairo_rectangle_t must be a hash reference");

	hv = (HV *) SvRV (sv);
	rectangle = cairo_perl_alloc_temp (sizeof (cairo_rectangle_t));

	value = hv_fetchs (hv, "x", 0);
	if (value && SvOK (*value))
		rectangle->x = SvNV (*value);

	value = hv_fetchs (hv, "y", 0);
	if (value && SvOK (*value))
		rectangle->y = SvNV (*value);

	value = hv_fetchs (hv, "width", 0);
	if (value && SvOK (*value))
		rectangle->width = SvNV (*value);

	value = hv_fetchs (hv, "height", 0);
	if (value && SvOK (*value))
		rectangle->height = SvNV (*value);

	return rectangle;
}

#endif

/* ------------------------------------------------------------------------- */

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)

SV *
newSVCairoRectangleInt (cairo_rectangle_int_t *rectangle)
{
	HV *hv;

	if (!rectangle)
		return &PL_sv_undef;

	hv = newHV ();

	hv_store (hv, "x", 1, newSViv (rectangle->x), 0);
	hv_store (hv, "y", 1, newSViv (rectangle->y), 0);
	hv_store (hv, "width", 5, newSViv (rectangle->width), 0);
	hv_store (hv, "height", 6, newSViv (rectangle->height), 0);

	return newRV_noinc ((SV *) hv);
}

cairo_rectangle_int_t *
SvCairoRectangleInt (SV *sv)
{
	HV *hv;
	SV **value;
	cairo_rectangle_int_t *rectangle;

	if (!cairo_perl_sv_is_hash_ref (sv))
		croak ("cairo_rectangle_int_t must be a hash reference");

	hv = (HV *) SvRV (sv);
	rectangle = cairo_perl_alloc_temp (sizeof (cairo_rectangle_t));

	value = hv_fetchs (hv, "x", 0);
	if (value && SvOK (*value))
		rectangle->x = SvIV (*value);

	value = hv_fetchs (hv, "y", 0);
	if (value && SvOK (*value))
		rectangle->y = SvIV (*value);

	value = hv_fetchs (hv, "width", 0);
	if (value && SvOK (*value))
		rectangle->width = SvIV (*value);

	value = hv_fetchs (hv, "height", 0);
	if (value && SvOK (*value))
		rectangle->height = SvIV (*value);

	return rectangle;
}

#endif

/* ------------------------------------------------------------------------- */

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)

SV *
newSVCairoTextCluster (cairo_text_cluster_t *cluster)
{
	HV *hv;

	if (!cluster)
		return &PL_sv_undef;

	hv = newHV ();

	hv_store (hv, "num_bytes", 9, newSViv (cluster->num_bytes), 0);
	hv_store (hv, "num_glyphs", 10, newSVnv (cluster->num_glyphs), 0);

	return newRV_noinc ((SV *) hv);
}

cairo_text_cluster_t *
SvCairoTextCluster (SV *sv)
{
	HV *hv;
	SV **value;
	cairo_text_cluster_t *cluster;

	if (!cairo_perl_sv_is_hash_ref (sv))
		croak ("cairo_text_cluster_t must be a hash reference");

	hv = (HV *) SvRV (sv);
	cluster = cairo_perl_alloc_temp (sizeof (cairo_text_cluster_t));

	value = hv_fetch (hv, "num_bytes", 9, 0);
	if (value && SvOK (*value))
		cluster->num_bytes = SvIV (*value);

	value = hv_fetch (hv, "num_glyphs", 10, 0);
	if (value && SvOK (*value))
		cluster->num_glyphs = SvIV (*value);

	return cluster;
}

#endif

/* ------------------------------------------------------------------------- */

#line 430 "Cairo.c"
#ifndef PERL_UNUSED_VAR
#  define PERL_UNUSED_VAR(var) if (0) var = var
#endif

#ifndef dVAR
#  define dVAR		dNOOP
#endif


/* This stuff is not part of the API! You have been warned. */
#ifndef PERL_VERSION_DECIMAL
#  define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
#endif
#ifndef PERL_DECIMAL_VERSION
#  define PERL_DECIMAL_VERSION \
	  PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
#endif
#ifndef PERL_VERSION_GE
#  define PERL_VERSION_GE(r,v,s) \
	  (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
#endif
#ifndef PERL_VERSION_LE
#  define PERL_VERSION_LE(r,v,s) \
	  (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
#endif

/* XS_INTERNAL is the explicit static-linkage variant of the default
 * XS macro.
 *
 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
 * for anything but the BOOT XSUB.
 *
 * See XSUB.h in core!
 */


/* TODO: This might be compatible further back than 5.10.0. */
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
#  undef XS_EXTERNAL
#  undef XS_INTERNAL
#  if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
#    define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
#    define XS_INTERNAL(name) STATIC XSPROTO(name)
#  endif
#  if defined(__SYMBIAN32__)
#    define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
#    define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
#  endif
#  ifndef XS_EXTERNAL
#    if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
#      define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
#      define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
#    else
#      ifdef __cplusplus
#        define XS_EXTERNAL(name) extern "C" XSPROTO(name)
#        define XS_INTERNAL(name) static XSPROTO(name)
#      else
#        define XS_EXTERNAL(name) XSPROTO(name)
#        define XS_INTERNAL(name) STATIC XSPROTO(name)
#      endif
#    endif
#  endif
#endif

/* perl >= 5.10.0 && perl <= 5.15.1 */


/* The XS_EXTERNAL macro is used for functions that must not be static
 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
 * macro defined, the best we can do is assume XS is the same.
 * Dito for XS_INTERNAL.
 */
#ifndef XS_EXTERNAL
#  define XS_EXTERNAL(name) XS(name)
#endif
#ifndef XS_INTERNAL
#  define XS_INTERNAL(name) XS(name)
#endif

/* Now, finally, after all this mess, we want an ExtUtils::ParseXS
 * internal macro that we're free to redefine for varying linkage due
 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
 */

#undef XS_EUPXS
#if defined(PERL_EUPXS_ALWAYS_EXPORT)
#  define XS_EUPXS(name) XS_EXTERNAL(name)
#else
   /* default to internal */
#  define XS_EUPXS(name) XS_INTERNAL(name)
#endif

#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)

/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params);

STATIC void
S_croak_xs_usage(const CV *const cv, const char *const params)
{
    const GV *const gv = CvGV(cv);

    PERL_ARGS_ASSERT_CROAK_XS_USAGE;

    if (gv) {
        const char *const gvname = GvNAME(gv);
        const HV *const stash = GvSTASH(gv);
        const char *const hvname = stash ? HvNAME(stash) : NULL;

        if (hvname)
	    Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
        else
	    Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
    } else {
        /* Pants. I don't think that it should be possible to get here. */
	Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
    }
}
#undef  PERL_ARGS_ASSERT_CROAK_XS_USAGE

#define croak_xs_usage        S_croak_xs_usage

#endif

/* NOTE: the prototype of newXSproto() is different in versions of perls,
 * so we define a portable version of newXSproto()
 */
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */

#if PERL_VERSION_LE(5, 21, 5)
#  define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
#else
#  define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
#endif

#line 574 "Cairo.c"

XS_EUPXS(XS_Cairo_LIB_VERSION); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_LIB_VERSION)
{
    dVAR; dXSARGS;
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
    {
	int	RETVAL;
	dXSTARG;
#line 431 "Cairo.xs"
	PERL_UNUSED_VAR (items);
	RETVAL = CAIRO_VERSION;
#line 588 "Cairo.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_LIB_VERSION_ENCODE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_LIB_VERSION_ENCODE)
{
    dVAR; dXSARGS;
    dXSI32;
    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
    {
#line 440 "Cairo.xs"
	int major, minor, micro;
#line 606 "Cairo.c"
	int	RETVAL;
	dXSTARG;
#line 442 "Cairo.xs"
	PERL_UNUSED_VAR (ix);
	if (items == 3) {
		major = SvIV (ST (0));
		minor = SvIV (ST (1));
		micro = SvIV (ST (2));
	} else if (items == 4) {
		major = SvIV (ST (1));
		minor = SvIV (ST (2));
		micro = SvIV (ST (3));
	} else {
		croak ("Usage: Cairo::LIB_VERSION_ENCODE (major, minor, micro) or Cairo->LIB_VERSION_ENCODE (major, minor, micro)");
	}

	RETVAL = CAIRO_VERSION_ENCODE (major, minor, micro);
#line 624 "Cairo.c"
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_version); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_version)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "class=NULL");
    {
	int	RETVAL;
	dXSTARG;

	RETVAL = cairo_version(/* void */);
	XSprePUSH;
	PUSHi((IV)RETVAL);
#line 466 "Cairo.xs"
	PERL_UNUSED_VAR (ix);
#line 648 "Cairo.c"
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_version_string); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_version_string)
{
    dVAR; dXSARGS;
    dXSI32;
    if (items < 0 || items > 1)
       croak_xs_usage(cv,  "class=NULL");
    {
	const char *	RETVAL;
	dXSTARG;

	RETVAL = cairo_version_string(/* void */);
	sv_setpv(TARG, RETVAL);
	XSprePUSH;
	PUSHTARG;
#line 475 "Cairo.xs"
	PERL_UNUSED_VAR (ix);
#line 671 "Cairo.c"
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_create); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_create)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "class, target");
    {
	cairo_t_noinc *	RETVAL;
	cairo_surface_t *	target = SvCairoSurface (ST(1))
;

	RETVAL = cairo_create(target);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairo_noinc (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_DESTROY); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_DESTROY)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
#line 487 "Cairo.xs"
	cairo_destroy (cr);
#line 711 "Cairo.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_save); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_save)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_save(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_restore); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_restore)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_restore(cr);
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAA 1


XS_EUPXS(XS_Cairo__Context_push_group); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_push_group)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_push_group(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_push_group_with_content); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_push_group_with_content)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, content");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_content_t	content = SvCairoContent (ST(1))
;

	cairo_push_group_with_content(cr, content);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_pop_group); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_pop_group)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_pattern_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_pop_group(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoPattern (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_pop_group_to_source); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_pop_group_to_source)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_pop_group_to_source(cr);
    }
    XSRETURN_EMPTY;
}

#endif

XS_EUPXS(XS_Cairo__Context_set_operator); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_operator)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, op");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_operator_t	op = SvCairoOperator (ST(1))
;

	cairo_set_operator(cr, op);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_source_rgb); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_source_rgb)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "cr, red, green, blue");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	red = (double)SvNV(ST(1))
;
	double	green = (double)SvNV(ST(2))
;
	double	blue = (double)SvNV(ST(3))
;

	cairo_set_source_rgb(cr, red, green, blue);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_source_rgba); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_source_rgba)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "cr, red, green, blue, alpha");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	red = (double)SvNV(ST(1))
;
	double	green = (double)SvNV(ST(2))
;
	double	blue = (double)SvNV(ST(3))
;
	double	alpha = (double)SvNV(ST(4))
;

	cairo_set_source_rgba(cr, red, green, blue, alpha);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_source); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_source)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, source");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_pattern_t *	source = SvCairoPattern (ST(1))
;

	cairo_set_source(cr, source);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_source_surface); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_source_surface)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "cr, surface, x, y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_surface_t *	surface = SvCairoSurface (ST(1))
;
	double	x = (double)SvNV(ST(2))
;
	double	y = (double)SvNV(ST(3))
;

	cairo_set_source_surface(cr, surface, x, y);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_tolerance); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_tolerance)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, tolerance");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	tolerance = (double)SvNV(ST(1))
;

	cairo_set_tolerance(cr, tolerance);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_antialias); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_antialias)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, antialias");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_antialias_t	antialias = SvCairoAntialias (ST(1))
;

	cairo_set_antialias(cr, antialias);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_fill_rule); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_fill_rule)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, fill_rule");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_fill_rule_t	fill_rule = SvCairoFillRule (ST(1))
;

	cairo_set_fill_rule(cr, fill_rule);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_line_width); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_line_width)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, width");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	width = (double)SvNV(ST(1))
;

	cairo_set_line_width(cr, width);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_line_cap); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_line_cap)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, line_cap");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_line_cap_t	line_cap = SvCairoLineCap (ST(1))
;

	cairo_set_line_cap(cr, line_cap);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_line_join); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_line_join)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, line_join");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_line_join_t	line_join = SvCairoLineJoin (ST(1))
;

	cairo_set_line_join(cr, line_join);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_dash); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_dash)
{
    dVAR; dXSARGS;
    if (items < 2)
       croak_xs_usage(cv,  "cr, offset, ...");
    {
#line 530 "Cairo.xs"
	int i, n;
	double *pts;
#line 1048 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
	double	offset = (double)SvNV(ST(1))
;
#line 533 "Cairo.xs"
#define FIRST 2
	n = (items - FIRST);
	if (n == 0) {
		pts = NULL;
	} else {
		New (0, pts, n, double);
		if (!pts)
			croak ("malloc failure for (%d) elements", n);
		for (i = FIRST ; i < items ; i++)
			pts[i - FIRST] = SvNV (ST (i));
	}
#undef FIRST
	cairo_set_dash (cr, pts, n, offset);
#line 1067 "Cairo.c"
#line 547 "Cairo.xs"
	if (pts)
		Safefree (pts);
#line 1071 "Cairo.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_miter_limit); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_miter_limit)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, limit");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	limit = (double)SvNV(ST(1))
;

	cairo_set_miter_limit(cr, limit);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_translate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_translate)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, tx, ty");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	tx = (double)SvNV(ST(1))
;
	double	ty = (double)SvNV(ST(2))
;

	cairo_translate(cr, tx, ty);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_scale); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_scale)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, sx, sy");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	sx = (double)SvNV(ST(1))
;
	double	sy = (double)SvNV(ST(2))
;

	cairo_scale(cr, sx, sy);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_rotate); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_rotate)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, angle");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	angle = (double)SvNV(ST(1))
;

	cairo_rotate(cr, angle);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_transform); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_transform)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, matrix");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const cairo_matrix_t *	matrix = SvCairoMatrix (ST(1))
;

	cairo_transform(cr, matrix);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_matrix)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, matrix");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const cairo_matrix_t *	matrix = SvCairoMatrix (ST(1))
;

	cairo_set_matrix(cr, matrix);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_identity_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_identity_matrix)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_identity_matrix(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_user_to_device); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_user_to_device)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	cairo_user_to_device(cr, &x, &y);
	XSprePUSH;	EXTEND(SP,2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y);
    }
    XSRETURN(2);
}


XS_EUPXS(XS_Cairo__Context_user_to_device_distance); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_user_to_device_distance)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, dx, dy");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	dx = (double)SvNV(ST(1))
;
	double	dy = (double)SvNV(ST(2))
;

	cairo_user_to_device_distance(cr, &dx, &dy);
	XSprePUSH;	EXTEND(SP,2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)dx);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)dy);
    }
    XSRETURN(2);
}


XS_EUPXS(XS_Cairo__Context_device_to_user); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_device_to_user)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	cairo_device_to_user(cr, &x, &y);
	XSprePUSH;	EXTEND(SP,2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y);
    }
    XSRETURN(2);
}


XS_EUPXS(XS_Cairo__Context_device_to_user_distance); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_device_to_user_distance)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, dx, dy");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	dx = (double)SvNV(ST(1))
;
	double	dy = (double)SvNV(ST(2))
;

	cairo_device_to_user_distance(cr, &dx, &dy);
	XSprePUSH;	EXTEND(SP,2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)dx);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)dy);
    }
    XSRETURN(2);
}


XS_EUPXS(XS_Cairo__Context_new_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_new_path)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_new_path(cr);
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAB 1


XS_EUPXS(XS_Cairo__Context_new_sub_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_new_sub_path)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_new_sub_path(cr);
    }
    XSRETURN_EMPTY;
}

#endif

XS_EUPXS(XS_Cairo__Context_move_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_move_to)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	cairo_move_to(cr, x, y);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_line_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_line_to)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	cairo_line_to(cr, x, y);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_curve_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_curve_to)
{
    dVAR; dXSARGS;
    if (items != 7)
       croak_xs_usage(cv,  "cr, x1, y1, x2, y2, x3, y3");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x1 = (double)SvNV(ST(1))
;
	double	y1 = (double)SvNV(ST(2))
;
	double	x2 = (double)SvNV(ST(3))
;
	double	y2 = (double)SvNV(ST(4))
;
	double	x3 = (double)SvNV(ST(5))
;
	double	y3 = (double)SvNV(ST(6))
;

	cairo_curve_to(cr, x1, y1, x2, y2, x3, y3);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_arc); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_arc)
{
    dVAR; dXSARGS;
    if (items != 6)
       croak_xs_usage(cv,  "cr, xc, yc, radius, angle1, angle2");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	xc = (double)SvNV(ST(1))
;
	double	yc = (double)SvNV(ST(2))
;
	double	radius = (double)SvNV(ST(3))
;
	double	angle1 = (double)SvNV(ST(4))
;
	double	angle2 = (double)SvNV(ST(5))
;

	cairo_arc(cr, xc, yc, radius, angle1, angle2);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_arc_negative); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_arc_negative)
{
    dVAR; dXSARGS;
    if (items != 6)
       croak_xs_usage(cv,  "cr, xc, yc, radius, angle1, angle2");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	xc = (double)SvNV(ST(1))
;
	double	yc = (double)SvNV(ST(2))
;
	double	radius = (double)SvNV(ST(3))
;
	double	angle1 = (double)SvNV(ST(4))
;
	double	angle2 = (double)SvNV(ST(5))
;

	cairo_arc_negative(cr, xc, yc, radius, angle1, angle2);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_rel_move_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_rel_move_to)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, dx, dy");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	dx = (double)SvNV(ST(1))
;
	double	dy = (double)SvNV(ST(2))
;

	cairo_rel_move_to(cr, dx, dy);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_rel_line_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_rel_line_to)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, dx, dy");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	dx = (double)SvNV(ST(1))
;
	double	dy = (double)SvNV(ST(2))
;

	cairo_rel_line_to(cr, dx, dy);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_rel_curve_to); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_rel_curve_to)
{
    dVAR; dXSARGS;
    if (items != 7)
       croak_xs_usage(cv,  "cr, dx1, dy1, dx2, dy2, dx3, dy3");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	dx1 = (double)SvNV(ST(1))
;
	double	dy1 = (double)SvNV(ST(2))
;
	double	dx2 = (double)SvNV(ST(3))
;
	double	dy2 = (double)SvNV(ST(4))
;
	double	dx3 = (double)SvNV(ST(5))
;
	double	dy3 = (double)SvNV(ST(6))
;

	cairo_rel_curve_to(cr, dx1, dy1, dx2, dy2, dx3, dy3);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_rectangle); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_rectangle)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "cr, x, y, width, height");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;
	double	width = (double)SvNV(ST(3))
;
	double	height = (double)SvNV(ST(4))
;

	cairo_rectangle(cr, x, y, width, height);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_close_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_close_path)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_close_path(cr);
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
#define XSubPPtmpAAAC 1


XS_EUPXS(XS_Cairo__Context_path_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_path_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x1;
	double	y1;
	double	x2;
	double	y2;

	cairo_path_extents(cr, &x1, &y1, &x2, &y2);
	XSprePUSH;	EXTEND(SP,4);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(2), (double)x2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(3), (double)y2);
    }
    XSRETURN(4);
}

#endif

XS_EUPXS(XS_Cairo__Context_paint); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_paint)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_paint(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_paint_with_alpha); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_paint_with_alpha)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, alpha");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	alpha = (double)SvNV(ST(1))
;

	cairo_paint_with_alpha(cr, alpha);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_mask); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_mask)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, pattern");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_pattern_t *	pattern = SvCairoPattern (ST(1))
;

	cairo_mask(cr, pattern);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_mask_surface); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_mask_surface)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "cr, surface, surface_x, surface_y");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_surface_t *	surface = SvCairoSurface (ST(1))
;
	double	surface_x = (double)SvNV(ST(2))
;
	double	surface_y = (double)SvNV(ST(3))
;

	cairo_mask_surface(cr, surface, surface_x, surface_y);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_stroke); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_stroke)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_stroke(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_stroke_preserve); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_stroke_preserve)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_stroke_preserve(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_fill); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_fill)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_fill(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_fill_preserve); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_fill_preserve)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_fill_preserve(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_copy_page); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_copy_page)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_copy_page(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_show_page); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_show_page)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_show_page(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_in_stroke); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_in_stroke)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	int	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	RETVAL = cairo_in_stroke(cr, x, y);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_in_fill); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_in_fill)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	int	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	RETVAL = cairo_in_fill(cr, x, y);
	XSprePUSH;
	PUSHi((IV)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_stroke_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_stroke_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x1;
	double	y1;
	double	x2;
	double	y2;

	cairo_stroke_extents(cr, &x1, &y1, &x2, &y2);
	XSprePUSH;	EXTEND(SP,4);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(2), (double)x2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(3), (double)y2);
    }
    XSRETURN(4);
}


XS_EUPXS(XS_Cairo__Context_fill_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_fill_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x1;
	double	y1;
	double	x2;
	double	y2;

	cairo_fill_extents(cr, &x1, &y1, &x2, &y2);
	XSprePUSH;	EXTEND(SP,4);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(2), (double)x2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(3), (double)y2);
    }
    XSRETURN(4);
}


XS_EUPXS(XS_Cairo__Context_clip); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_clip)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_clip(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_clip_preserve); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_clip_preserve)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_clip_preserve(cr);
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
#define XSubPPtmpAAAD 1


XS_EUPXS(XS_Cairo__Context_copy_clip_rectangle_list); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_copy_clip_rectangle_list)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 643 "Cairo.xs"
	cairo_rectangle_list_t *list;
	int i;
#line 1925 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
#line 646 "Cairo.xs"
	list = cairo_copy_clip_rectangle_list (cr);
	CAIRO_PERL_CHECK_STATUS (list->status);
	EXTEND (sp, list->num_rectangles);
	for (i = 0; i < list->num_rectangles; i++)
		PUSHs (sv_2mortal (newSVCairoRectangle (&(list->rectangles[i]))));
	cairo_rectangle_list_destroy (list);
#line 1935 "Cairo.c"
	PUTBACK;
	return;
    }
}


XS_EUPXS(XS_Cairo__Context_clip_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_clip_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x1;
	double	y1;
	double	x2;
	double	y2;

	cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
	XSprePUSH;	EXTEND(SP,4);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y1);
	PUSHs(sv_newmortal());
	sv_setnv(ST(2), (double)x2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(3), (double)y2);
    }
    XSRETURN(4);
}

#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
#define XSubPPtmpAAAE 1


XS_EUPXS(XS_Cairo__Context_in_clip); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_in_clip)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, x, y");
    {
	cairo_bool_t	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x = (double)SvNV(ST(1))
;
	double	y = (double)SvNV(ST(2))
;

	RETVAL = cairo_in_clip(cr, x, y);
	XSprePUSH;
	PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__Context_reset_clip); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_reset_clip)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;

	cairo_reset_clip(cr);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_select_font_face); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_select_font_face)
{
    dVAR; dXSARGS;
    if (items != 4)
       croak_xs_usage(cv,  "cr, family, slant, weight");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	family;
	cairo_font_slant_t	slant = SvCairoFontSlant (ST(2))
;
	cairo_font_weight_t	weight = SvCairoFontWeight (ST(3))
;

	sv_utf8_upgrade (ST(1));
	family = (const char_utf8 *) SvPV_nolen (ST(1))
;

	cairo_select_font_face(cr, family, slant, weight);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_font_size); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_font_size)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, size");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	size = (double)SvNV(ST(1))
;

	cairo_set_font_size(cr, size);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_set_font_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_font_matrix)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, matrix");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const cairo_matrix_t *	matrix = SvCairoMatrix (ST(1))
;

	cairo_set_font_matrix(cr, matrix);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_get_font_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_font_matrix)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
#line 674 "Cairo.xs"
	cairo_matrix_t matrix;
#line 2086 "Cairo.c"
	cairo_matrix_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
#line 676 "Cairo.xs"
	cairo_get_font_matrix (cr, &matrix);
	RETVAL = cairo_perl_copy_matrix (&matrix);
#line 2093 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoMatrix (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_set_font_options); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_font_options)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, options");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const cairo_font_options_t *	options = SvCairoFontOptions (ST(1))
;

	cairo_set_font_options(cr, options);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_get_font_options); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_font_options)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_font_options_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
#line 686 "Cairo.xs"
	RETVAL = cairo_font_options_create ();
	cairo_get_font_options (cr, RETVAL);
#line 2136 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontOptions (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAF 1


XS_EUPXS(XS_Cairo__Context_set_scaled_font); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_scaled_font)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, scaled_font");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const cairo_scaled_font_t *	scaled_font = SvCairoScaledFont (ST(1))
;

	cairo_set_scaled_font(cr, scaled_font);
    }
    XSRETURN_EMPTY;
}

#endif
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
#define XSubPPtmpAAAG 1


XS_EUPXS(XS_Cairo__Context_get_scaled_font); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_scaled_font)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_scaled_font_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_scaled_font(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoScaledFont (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__Context_show_text); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_show_text)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, utf8");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	utf8;

	sv_utf8_upgrade (ST(1));
	utf8 = (const char_utf8 *) SvPV_nolen (ST(1))
;

	cairo_show_text(cr, utf8);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_show_glyphs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_show_glyphs)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "cr, ...");
    {
#line 708 "Cairo.xs"
	cairo_glyph_t * glyphs = NULL;
	int num_glyphs, i;
#line 2228 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
#line 711 "Cairo.xs"
	num_glyphs = items - 1;
	Newz (0, glyphs, num_glyphs, cairo_glyph_t);
	for (i = 1; i < items; i++)
		glyphs[i - 1] = *SvCairoGlyph (ST (i));
	cairo_show_glyphs (cr, glyphs, num_glyphs);
	Safefree (glyphs);
#line 2238 "Cairo.c"
    }
    XSRETURN_EMPTY;
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
#define XSubPPtmpAAAH 1


XS_EUPXS(XS_Cairo__Context_show_text_glyphs); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_show_text_glyphs)
{
    dVAR; dXSARGS;
    if (items != 5)
       croak_xs_usage(cv,  "cr, utf8_sv, glyphs_sv, clusters_sv, cluster_flags");
    {
#line 724 "Cairo.xs"
	const char *utf8 = NULL;
	STRLEN utf8_len = 0;
	cairo_glyph_t * glyphs = NULL;
	cairo_text_cluster_t * clusters = NULL;
	int i, num_glyphs, num_clusters;
	AV *glyphs_av, *clusters_av;
#line 2261 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
	SV *	utf8_sv = ST(1)
;
	SV *	glyphs_sv = ST(2)
;
	SV *	clusters_sv = ST(3)
;
	cairo_text_cluster_flags_t	cluster_flags = SvCairoTextClusterFlags (ST(4))
;
#line 731 "Cairo.xs"
	if (!cairo_perl_sv_is_array_ref (glyphs_sv))
		croak ("glyphs must be an array ref");
	if (!cairo_perl_sv_is_array_ref (clusters_sv))
		croak ("text clusters must be an array ref");

	sv_utf8_upgrade (utf8_sv);
	utf8 = SvPV (utf8_sv, utf8_len);

	glyphs_av = (AV *) SvRV (glyphs_sv);
	num_glyphs = av_len (glyphs_av) + 1;
	glyphs = cairo_glyph_allocate (num_glyphs);
	for (i = 0; i < num_glyphs; i++) {
		SV **value = av_fetch (glyphs_av, i, 0);
		if (value)
			glyphs[i] = *SvCairoGlyph (*value);
	}

	clusters_av = (AV *) SvRV (clusters_sv);
	num_clusters = av_len (clusters_av) + 1;
	clusters = cairo_text_cluster_allocate (num_clusters);
	for (i = 0; i < num_clusters; i++) {
		SV **value = av_fetch (clusters_av, i, 0);
		if (value)
			clusters[i] = *SvCairoTextCluster (*value);
	}

	cairo_show_text_glyphs (cr,
	                        utf8, (int) utf8_len,
	                        glyphs, num_glyphs,
	                        clusters, num_clusters, cluster_flags);

	cairo_text_cluster_free (clusters);
	cairo_glyph_free (glyphs);
#line 2306 "Cairo.c"
    }
    XSRETURN_EMPTY;
}

#endif

XS_EUPXS(XS_Cairo__Context_get_font_face); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_font_face)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_font_face_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_font_face(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontFace (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_font_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_font_extents)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
#line 772 "Cairo.xs"
	cairo_font_extents_t extents;
#line 2345 "Cairo.c"
	cairo_font_extents_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
#line 774 "Cairo.xs"
	cairo_font_extents (cr, &extents);
	RETVAL = &extents;
#line 2352 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFontExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_set_font_face); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_set_font_face)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, font_face");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_font_face_t *	font_face = SvCairoFontFace (ST(1))
;

	cairo_set_font_face(cr, font_face);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_text_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_text_extents)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, utf8");
    {
#line 784 "Cairo.xs"
	cairo_text_extents_t extents;
#line 2391 "Cairo.c"
	cairo_text_extents_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	utf8;

	sv_utf8_upgrade (ST(1));
	utf8 = (const char_utf8 *) SvPV_nolen (ST(1))
;
#line 786 "Cairo.xs"
	cairo_text_extents (cr, utf8, &extents);
	RETVAL = &extents;
#line 2403 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoTextExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_glyph_extents); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_glyph_extents)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "cr, ...");
    {
#line 794 "Cairo.xs"
	cairo_text_extents_t extents;
	cairo_glyph_t * glyphs = NULL;
	int num_glyphs, i;
#line 2426 "Cairo.c"
	cairo_text_extents_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
#line 798 "Cairo.xs"
	num_glyphs = items - 1;
	Newz (0, glyphs, num_glyphs, cairo_glyph_t);
	for (i = 1; i < items; i++)
		glyphs[i - 1] = *SvCairoGlyph (ST (i));
	cairo_glyph_extents (cr, glyphs, num_glyphs, &extents);
	RETVAL = &extents;
	Safefree (glyphs);
#line 2438 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoTextExtents (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_text_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_text_path)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, utf8");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	utf8;

	sv_utf8_upgrade (ST(1));
	utf8 = (const char_utf8 *) SvPV_nolen (ST(1))
;

	cairo_text_path(cr, utf8);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_glyph_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_glyph_path)
{
    dVAR; dXSARGS;
    if (items < 1)
       croak_xs_usage(cv,  "cr, ...");
    {
#line 813 "Cairo.xs"
	cairo_glyph_t * glyphs = NULL;
	int num_glyphs, i;
#line 2481 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
#line 816 "Cairo.xs"
	num_glyphs = items - 1;
	Newz (0, glyphs, num_glyphs, cairo_glyph_t);
	for (i = 1; i < items; i++)
		glyphs[i - 1] = *SvCairoGlyph (ST (i));
	cairo_glyph_path (cr, glyphs, num_glyphs);
	Safefree (glyphs);
#line 2491 "Cairo.c"
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_get_operator); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_operator)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_operator_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_operator(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoOperator (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_source); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_source)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_pattern_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_source(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoPattern (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_tolerance); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_tolerance)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	double	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_tolerance(cr);
	XSprePUSH;
	PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_antialias); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_antialias)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_antialias_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_antialias(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoAntialias (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
#define XSubPPtmpAAAI 1


XS_EUPXS(XS_Cairo__Context_has_current_point); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_has_current_point)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_bool_t	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_has_current_point(cr);
	XSprePUSH;
	PUSHu((UV)RETVAL);
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__Context_get_current_point); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_current_point)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	double	x;
	double	y;

	cairo_get_current_point(cr, &x, &y);
	XSprePUSH;	EXTEND(SP,2);
	PUSHs(sv_newmortal());
	sv_setnv(ST(0), (double)x);
	PUSHs(sv_newmortal());
	sv_setnv(ST(1), (double)y);
    }
    XSRETURN(2);
}


XS_EUPXS(XS_Cairo__Context_get_fill_rule); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_fill_rule)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_fill_rule_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_fill_rule(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoFillRule (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_line_width); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_line_width)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	double	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_line_width(cr);
	XSprePUSH;
	PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_line_cap); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_line_cap)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_line_cap_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_line_cap(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoLineCap (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_line_join); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_line_join)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_line_join_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_line_join(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoLineJoin (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_miter_limit); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_miter_limit)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	double	RETVAL;
	dXSTARG;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_miter_limit(cr);
	XSprePUSH;
	PUSHn((double)RETVAL);
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
#define XSubPPtmpAAAJ 1


XS_EUPXS(XS_Cairo__Context_get_dash); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_dash)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    PERL_UNUSED_VAR(ax); /* -Wall */
    SP -= items;
    {
#line 855 "Cairo.xs"
	int count, i;
	double *dashes, offset;
#line 2757 "Cairo.c"
	cairo_t *	cr = SvCairo (ST(0))
;
#line 858 "Cairo.xs"
	count = cairo_get_dash_count (cr);
	if (count == 0) {
		dashes = NULL;
	} else {
		New (0, dashes, count, double);
		if (!dashes)
			croak ("malloc failure for (%d) elements", count);
	}
	cairo_get_dash (cr, dashes, &offset);
	EXTEND (sp, count + 1);
	PUSHs (sv_2mortal (newSVnv (offset)));
	for (i = 0; i < count; i++)
		PUSHs (sv_2mortal (newSVnv (dashes[i])));
	Safefree (dashes);
#line 2775 "Cairo.c"
	PUTBACK;
	return;
    }
}

#endif

XS_EUPXS(XS_Cairo__Context_get_matrix); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_matrix)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
#line 878 "Cairo.xs"
	cairo_matrix_t matrix;
#line 2792 "Cairo.c"
	cairo_matrix_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;
#line 880 "Cairo.xs"
	cairo_get_matrix (cr, &matrix);
	RETVAL = cairo_perl_copy_matrix (&matrix);
#line 2799 "Cairo.c"
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoMatrix (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_get_target); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_target)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_surface_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_target(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoSurface (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
#define XSubPPtmpAAAK 1


XS_EUPXS(XS_Cairo__Context_get_group_target); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_get_group_target)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_surface_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_get_group_target(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoSurface (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#endif

XS_EUPXS(XS_Cairo__Context_copy_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_copy_path)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_path_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_copy_path(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoPath (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_copy_path_flat); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_copy_path_flat)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_path_t *	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_copy_path_flat(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoPath (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo__Context_append_path); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_append_path)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, path");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	cairo_path_t *	path = SvCairoPath (ST(1))
;

	cairo_append_path(cr, path);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_status); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_status)
{
    dVAR; dXSARGS;
    if (items != 1)
       croak_xs_usage(cv,  "cr");
    {
	cairo_status_t	RETVAL;
	cairo_t *	cr = SvCairo (ST(0))
;

	RETVAL = cairo_status(cr);
	{
	    SV * RETVALSV;
	    RETVALSV = newSVCairoStatus (RETVAL);
	    RETVALSV = sv_2mortal(RETVALSV);
	    ST(0) = RETVALSV;
	}
    }
    XSRETURN(1);
}

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 16, 0)
#define XSubPPtmpAAAL 1


XS_EUPXS(XS_Cairo__Context_tag_begin); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_tag_begin)
{
    dVAR; dXSARGS;
    if (items != 3)
       croak_xs_usage(cv,  "cr, tag_name, attributes");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	tag_name;
	const char_utf8 *	attributes;

	sv_utf8_upgrade (ST(1));
	tag_name = (const char_utf8 *) SvPV_nolen (ST(1))
;

	sv_utf8_upgrade (ST(2));
	attributes = (const char_utf8 *) SvPV_nolen (ST(2))
;

	cairo_tag_begin(cr, tag_name, attributes);
    }
    XSRETURN_EMPTY;
}


XS_EUPXS(XS_Cairo__Context_tag_end); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo__Context_tag_end)
{
    dVAR; dXSARGS;
    if (items != 2)
       croak_xs_usage(cv,  "cr, tag_name");
    {
	cairo_t *	cr = SvCairo (ST(0))
;
	const char_utf8 *	tag_name;

	sv_utf8_upgrade (ST(1));
	tag_name = (const char_utf8 *) SvPV_nolen (ST(1))
;

	cairo_tag_end(cr, tag_name);
    }
    XSRETURN_EMPTY;
}

#endif

XS_EUPXS(XS_Cairo_HAS_PS_SURFACE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_PS_SURFACE)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 921 "Cairo.xs"
#ifdef CAIRO_HAS_PS_SURFACE
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3013 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_HAS_PDF_SURFACE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_PDF_SURFACE)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 932 "Cairo.xs"
#ifdef CAIRO_HAS_PDF_SURFACE
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3034 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_HAS_SVG_SURFACE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_SVG_SURFACE)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 943 "Cairo.xs"
#ifdef CAIRO_HAS_SVG_SURFACE
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3055 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_HAS_RECORDING_SURFACE); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_RECORDING_SURFACE)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 954 "Cairo.xs"
#ifdef CAIRO_HAS_RECORDING_SURFACE
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3076 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_HAS_FT_FONT); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_FT_FONT)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 965 "Cairo.xs"
#ifdef CAIRO_HAS_FT_FONT
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3097 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}


XS_EUPXS(XS_Cairo_HAS_PNG_FUNCTIONS); /* prototype to pass -Wmissing-prototypes */
XS_EUPXS(XS_Cairo_HAS_PNG_FUNCTIONS)
{
    dVAR; dXSARGS;
    if (items != 0)
       croak_xs_usage(cv,  "");
    {
	bool	RETVAL;
#line 976 "Cairo.xs"
#ifdef CAIRO_HAS_PNG_FUNCTIONS
	RETVAL = TRUE;
#else
	RETVAL = FALSE;
#endif
#line 3118 "Cairo.c"
	ST(0) = boolSV(RETVAL);
    }
    XSRETURN(1);
}

#ifdef __cplusplus
extern "C" {
#endif
XS_EXTERNAL(boot_Cairo); /* prototype to pass -Wmissing-prototypes */
XS_EXTERNAL(boot_Cairo)
{
#if PERL_VERSION_LE(5, 21, 5)
    dVAR; dXSARGS;
#else
    dVAR; dXSBOOTARGSXSAPIVERCHK;
#endif
#if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
    char* file = __FILE__;
#else
    const char* file = __FILE__;
#endif

    PERL_UNUSED_VAR(file);

    PERL_UNUSED_VAR(cv); /* -W */
    PERL_UNUSED_VAR(items); /* -W */
#if PERL_VERSION_LE(5, 21, 5)
    XS_VERSION_BOOTCHECK;
#  ifdef XS_APIVERSION_BOOTCHECK
    XS_APIVERSION_BOOTCHECK;
#  endif
#endif

        newXS_deffile("Cairo::LIB_VERSION", XS_Cairo_LIB_VERSION);
        cv = newXS_deffile("Cairo::LIB_VERSION_ENCODE", XS_Cairo_LIB_VERSION_ENCODE);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Cairo::VERSION_ENCODE", XS_Cairo_LIB_VERSION_ENCODE);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Cairo::lib_version", XS_Cairo_version);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Cairo::version", XS_Cairo_version);
        XSANY.any_i32 = 0;
        cv = newXS_deffile("Cairo::lib_version_string", XS_Cairo_version_string);
        XSANY.any_i32 = 1;
        cv = newXS_deffile("Cairo::version_string", XS_Cairo_version_string);
        XSANY.any_i32 = 0;
        newXS_deffile("Cairo::Context::create", XS_Cairo__Context_create);
        newXS_deffile("Cairo::Context::DESTROY", XS_Cairo__Context_DESTROY);
        newXS_deffile("Cairo::Context::save", XS_Cairo__Context_save);
        newXS_deffile("Cairo::Context::restore", XS_Cairo__Context_restore);
#if XSubPPtmpAAAA
        newXS_deffile("Cairo::Context::push_group", XS_Cairo__Context_push_group);
        newXS_deffile("Cairo::Context::push_group_with_content", XS_Cairo__Context_push_group_with_content);
        newXS_deffile("Cairo::Context::pop_group", XS_Cairo__Context_pop_group);
        newXS_deffile("Cairo::Context::pop_group_to_source", XS_Cairo__Context_pop_group_to_source);
#endif
        newXS_deffile("Cairo::Context::set_operator", XS_Cairo__Context_set_operator);
        newXS_deffile("Cairo::Context::set_source_rgb", XS_Cairo__Context_set_source_rgb);
        newXS_deffile("Cairo::Context::set_source_rgba", XS_Cairo__Context_set_source_rgba);
        newXS_deffile("Cairo::Context::set_source", XS_Cairo__Context_set_source);
        newXS_deffile("Cairo::Context::set_source_surface", XS_Cairo__Context_set_source_surface);
        newXS_deffile("Cairo::Context::set_tolerance", XS_Cairo__Context_set_tolerance);
        newXS_deffile("Cairo::Context::set_antialias", XS_Cairo__Context_set_antialias);
        newXS_deffile("Cairo::Context::set_fill_rule", XS_Cairo__Context_set_fill_rule);
        newXS_deffile("Cairo::Context::set_line_width", XS_Cairo__Context_set_line_width);
        newXS_deffile("Cairo::Context::set_line_cap", XS_Cairo__Context_set_line_cap);
        newXS_deffile("Cairo::Context::set_line_join", XS_Cairo__Context_set_line_join);
        newXS_deffile("Cairo::Context::set_dash", XS_Cairo__Context_set_dash);
        newXS_deffile("Cairo::Context::set_miter_limit", XS_Cairo__Context_set_miter_limit);
        newXS_deffile("Cairo::Context::translate", XS_Cairo__Context_translate);
        newXS_deffile("Cairo::Context::scale", XS_Cairo__Context_scale);
        newXS_deffile("Cairo::Context::rotate", XS_Cairo__Context_rotate);
        newXS_deffile("Cairo::Context::transform", XS_Cairo__Context_transform);
        newXS_deffile("Cairo::Context::set_matrix", XS_Cairo__Context_set_matrix);
        newXS_deffile("Cairo::Context::identity_matrix", XS_Cairo__Context_identity_matrix);
        newXS_deffile("Cairo::Context::user_to_device", XS_Cairo__Context_user_to_device);
        newXS_deffile("Cairo::Context::user_to_device_distance", XS_Cairo__Context_user_to_device_distance);
        newXS_deffile("Cairo::Context::device_to_user", XS_Cairo__Context_device_to_user);
        newXS_deffile("Cairo::Context::device_to_user_distance", XS_Cairo__Context_device_to_user_distance);
        newXS_deffile("Cairo::Context::new_path", XS_Cairo__Context_new_path);
#if XSubPPtmpAAAB
        newXS_deffile("Cairo::Context::new_sub_path", XS_Cairo__Context_new_sub_path);
#endif
        newXS_deffile("Cairo::Context::move_to", XS_Cairo__Context_move_to);
        newXS_deffile("Cairo::Context::line_to", XS_Cairo__Context_line_to);
        newXS_deffile("Cairo::Context::curve_to", XS_Cairo__Context_curve_to);
        newXS_deffile("Cairo::Context::arc", XS_Cairo__Context_arc);
        newXS_deffile("Cairo::Context::arc_negative", XS_Cairo__Context_arc_negative);
        newXS_deffile("Cairo::Context::rel_move_to", XS_Cairo__Context_rel_move_to);
        newXS_deffile("Cairo::Context::rel_line_to", XS_Cairo__Context_rel_line_to);
        newXS_deffile("Cairo::Context::rel_curve_to", XS_Cairo__Context_rel_curve_to);
        newXS_deffile("Cairo::Context::rectangle", XS_Cairo__Context_rectangle);
        newXS_deffile("Cairo::Context::close_path", XS_Cairo__Context_close_path);
#if XSubPPtmpAAAC
        newXS_deffile("Cairo::Context::path_extents", XS_Cairo__Context_path_extents);
#endif
        newXS_deffile("Cairo::Context::paint", XS_Cairo__Context_paint);
        newXS_deffile("Cairo::Context::paint_with_alpha", XS_Cairo__Context_paint_with_alpha);
        newXS_deffile("Cairo::Context::mask", XS_Cairo__Context_mask);
        newXS_deffile("Cairo::Context::mask_surface", XS_Cairo__Context_mask_surface);
        newXS_deffile("Cairo::Context::stroke", XS_Cairo__Context_stroke);
        newXS_deffile("Cairo::Context::stroke_preserve", XS_Cairo__Context_stroke_preserve);
        newXS_deffile("Cairo::Context::fill", XS_Cairo__Context_fill);
        newXS_deffile("Cairo::Context::fill_preserve", XS_Cairo__Context_fill_preserve);
        newXS_deffile("Cairo::Context::copy_page", XS_Cairo__Context_copy_page);
        newXS_deffile("Cairo::Context::show_page", XS_Cairo__Context_show_page);
        newXS_deffile("Cairo::Context::in_stroke", XS_Cairo__Context_in_stroke);
        newXS_deffile("Cairo::Context::in_fill", XS_Cairo__Context_in_fill);
        newXS_deffile("Cairo::Context::stroke_extents", XS_Cairo__Context_stroke_extents);
        newXS_deffile("Cairo::Context::fill_extents", XS_Cairo__Context_fill_extents);
        newXS_deffile("Cairo::Context::clip", XS_Cairo__Context_clip);
        newXS_deffile("Cairo::Context::clip_preserve", XS_Cairo__Context_clip_preserve);
#if XSubPPtmpAAAD
        newXS_deffile("Cairo::Context::copy_clip_rectangle_list", XS_Cairo__Context_copy_clip_rectangle_list);
        newXS_deffile("Cairo::Context::clip_extents", XS_Cairo__Context_clip_extents);
#endif
#if XSubPPtmpAAAE
        newXS_deffile("Cairo::Context::in_clip", XS_Cairo__Context_in_clip);
#endif
        newXS_deffile("Cairo::Context::reset_clip", XS_Cairo__Context_reset_clip);
        newXS_deffile("Cairo::Context::select_font_face", XS_Cairo__Context_select_font_face);
        newXS_deffile("Cairo::Context::set_font_size", XS_Cairo__Context_set_font_size);
        newXS_deffile("Cairo::Context::set_font_matrix", XS_Cairo__Context_set_font_matrix);
        newXS_deffile("Cairo::Context::get_font_matrix", XS_Cairo__Context_get_font_matrix);
        newXS_deffile("Cairo::Context::set_font_options", XS_Cairo__Context_set_font_options);
        newXS_deffile("Cairo::Context::get_font_options", XS_Cairo__Context_get_font_options);
#if XSubPPtmpAAAF
        newXS_deffile("Cairo::Context::set_scaled_font", XS_Cairo__Context_set_scaled_font);
#endif
#if XSubPPtmpAAAG
        newXS_deffile("Cairo::Context::get_scaled_font", XS_Cairo__Context_get_scaled_font);
#endif
        newXS_deffile("Cairo::Context::show_text", XS_Cairo__Context_show_text);
        newXS_deffile("Cairo::Context::show_glyphs", XS_Cairo__Context_show_glyphs);
#if XSubPPtmpAAAH
        newXS_deffile("Cairo::Context::show_text_glyphs", XS_Cairo__Context_show_text_glyphs);
#endif
        newXS_deffile("Cairo::Context::get_font_face", XS_Cairo__Context_get_font_face);
        newXS_deffile("Cairo::Context::font_extents", XS_Cairo__Context_font_extents);
        newXS_deffile("Cairo::Context::set_font_face", XS_Cairo__Context_set_font_face);
        newXS_deffile("Cairo::Context::text_extents", XS_Cairo__Context_text_extents);
        newXS_deffile("Cairo::Context::glyph_extents", XS_Cairo__Context_glyph_extents);
        newXS_deffile("Cairo::Context::text_path", XS_Cairo__Context_text_path);
        newXS_deffile("Cairo::Context::glyph_path", XS_Cairo__Context_glyph_path);
        newXS_deffile("Cairo::Context::get_operator", XS_Cairo__Context_get_operator);
        newXS_deffile("Cairo::Context::get_source", XS_Cairo__Context_get_source);
        newXS_deffile("Cairo::Context::get_tolerance", XS_Cairo__Context_get_tolerance);
        newXS_deffile("Cairo::Context::get_antialias", XS_Cairo__Context_get_antialias);
#if XSubPPtmpAAAI
        newXS_deffile("Cairo::Context::has_current_point", XS_Cairo__Context_has_current_point);
#endif
        newXS_deffile("Cairo::Context::get_current_point", XS_Cairo__Context_get_current_point);
        newXS_deffile("Cairo::Context::get_fill_rule", XS_Cairo__Context_get_fill_rule);
        newXS_deffile("Cairo::Context::get_line_width", XS_Cairo__Context_get_line_width);
        newXS_deffile("Cairo::Context::get_line_cap", XS_Cairo__Context_get_line_cap);
        newXS_deffile("Cairo::Context::get_line_join", XS_Cairo__Context_get_line_join);
        newXS_deffile("Cairo::Context::get_miter_limit", XS_Cairo__Context_get_miter_limit);
#if XSubPPtmpAAAJ
        newXS_deffile("Cairo::Context::get_dash", XS_Cairo__Context_get_dash);
#endif
        newXS_deffile("Cairo::Context::get_matrix", XS_Cairo__Context_get_matrix);
        newXS_deffile("Cairo::Context::get_target", XS_Cairo__Context_get_target);
#if XSubPPtmpAAAK
        newXS_deffile("Cairo::Context::get_group_target", XS_Cairo__Context_get_group_target);
#endif
        newXS_deffile("Cairo::Context::copy_path", XS_Cairo__Context_copy_path);
        newXS_deffile("Cairo::Context::copy_path_flat", XS_Cairo__Context_copy_path_flat);
        newXS_deffile("Cairo::Context::append_path", XS_Cairo__Context_append_path);
        newXS_deffile("Cairo::Context::status", XS_Cairo__Context_status);
#if XSubPPtmpAAAL
        newXS_deffile("Cairo::Context::tag_begin", XS_Cairo__Context_tag_begin);
        newXS_deffile("Cairo::Context::tag_end", XS_Cairo__Context_tag_end);
#endif
        newXS_deffile("Cairo::HAS_PS_SURFACE", XS_Cairo_HAS_PS_SURFACE);
        newXS_deffile("Cairo::HAS_PDF_SURFACE", XS_Cairo_HAS_PDF_SURFACE);
        newXS_deffile("Cairo::HAS_SVG_SURFACE", XS_Cairo_HAS_SVG_SURFACE);
        newXS_deffile("Cairo::HAS_RECORDING_SURFACE", XS_Cairo_HAS_RECORDING_SURFACE);
        newXS_deffile("Cairo::HAS_FT_FONT", XS_Cairo_HAS_FT_FONT);
        newXS_deffile("Cairo::HAS_PNG_FUNCTIONS", XS_Cairo_HAS_PNG_FUNCTIONS);

    /* Initialisation Section */

#line 423 "Cairo.xs"
#include "cairo-perl-boot.xsh"
#if CAIRO_PERL_DEBUG
	call_atexit ((ATEXIT_t) cairo_debug_reset_static_data, NULL);
#endif

#if XSubPPtmpAAAA
#endif
#if XSubPPtmpAAAB
#endif
#if XSubPPtmpAAAC
#endif
#if XSubPPtmpAAAD
#endif
#if XSubPPtmpAAAE
#endif
#if XSubPPtmpAAAF
#endif
#if XSubPPtmpAAAG
#endif
#if XSubPPtmpAAAH
#endif
#if XSubPPtmpAAAI
#endif
#if XSubPPtmpAAAJ
#endif
#if XSubPPtmpAAAK
#endif
#if XSubPPtmpAAAL
#line 908 "Cairo.xs"
    HV *stash = gv_stashpv("Cairo", 0);
    newCONSTSUB (stash, "TAG_DEST",  newSVpv (CAIRO_TAG_DEST, 0));
    newCONSTSUB (stash, "TAG_LINK",  newSVpv (CAIRO_TAG_LINK, 0));

#endif
#line 3336 "Cairo.c"

    /* End of Initialisation Section */

#if PERL_VERSION_LE(5, 21, 5)
#  if PERL_VERSION_GE(5, 9, 0)
    if (PL_unitcheckav)
        call_list(PL_scopestack_ix, PL_unitcheckav);
#  endif
    XSRETURN_YES;
#else
    Perl_xs_boot_epilog(aTHX_ ax);
#endif
}

#ifdef __cplusplus
}
#endif
