/*
** Lua binding: cairo_xlib
** Generated automatically by tolua++-1.0.92.
*/

#ifndef __cplusplus
#include "stdlib.h"
#endif
#include "string.h"

#include "tolua++.h"

/* Exported function */
TOLUA_API int  tolua_cairo_xlib_open (lua_State* tolua_S);

#include <cairo.h>
#include <cairo-xlib.h>
#include <X11/Xlib.h>

/* function to release collected object via destructor */
#ifdef __cplusplus

static int tolua_collect_Drawable (lua_State* tolua_S)
{
 Drawable* self = (Drawable*) tolua_tousertype(tolua_S,1,0);
	Mtolua_delete(self);
	return 0;
}
#endif


/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
 tolua_usertype(tolua_S,"cairo_surface_t");
 tolua_usertype(tolua_S,"Visual");
 tolua_usertype(tolua_S,"Screen");
 tolua_usertype(tolua_S,"Pixmap");
 tolua_usertype(tolua_S,"Drawable");
 tolua_usertype(tolua_S,"Display");
}

/* function: cairo_xlib_surface_create */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_create00
static int tolua_cairo_xlib_cairo_xlib_surface_create00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Display",0,&tolua_err) ||
     (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Drawable",0,&tolua_err)) ||
     !tolua_isusertype(tolua_S,3,"Visual",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,6,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Display* dpy = ((Display*)  tolua_tousertype(tolua_S,1,0));
  Drawable drawable = *((Drawable*)  tolua_tousertype(tolua_S,2,0));
  Visual* visual = ((Visual*)  tolua_tousertype(tolua_S,3,0));
  int width = ((int)  tolua_tonumber(tolua_S,4,0));
  int height = ((int)  tolua_tonumber(tolua_S,5,0));
  {
   cairo_surface_t* tolua_ret = (cairo_surface_t*)  cairo_xlib_surface_create(dpy,drawable,visual,width,height);
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"cairo_surface_t");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_create'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_create_for_bitmap */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_create_for_bitmap00
static int tolua_cairo_xlib_cairo_xlib_surface_create_for_bitmap00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"Display",0,&tolua_err) ||
     (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Pixmap",0,&tolua_err)) ||
     !tolua_isusertype(tolua_S,3,"Screen",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,5,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,6,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  Display* dpy = ((Display*)  tolua_tousertype(tolua_S,1,0));
  Pixmap bitmap = *((Pixmap*)  tolua_tousertype(tolua_S,2,0));
  Screen* screen = ((Screen*)  tolua_tousertype(tolua_S,3,0));
  int width = ((int)  tolua_tonumber(tolua_S,4,0));
  int height = ((int)  tolua_tonumber(tolua_S,5,0));
  {
   cairo_surface_t* tolua_ret = (cairo_surface_t*)  cairo_xlib_surface_create_for_bitmap(dpy,bitmap,screen,width,height);
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"cairo_surface_t");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_create_for_bitmap'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_set_size */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_set_size00
static int tolua_cairo_xlib_cairo_xlib_surface_set_size00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,4,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  int width = ((int)  tolua_tonumber(tolua_S,2,0));
  int height = ((int)  tolua_tonumber(tolua_S,3,0));
  {
   cairo_xlib_surface_set_size(surface,width,height);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_set_size'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_set_drawable */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_set_drawable00
static int tolua_cairo_xlib_cairo_xlib_surface_set_drawable00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Drawable",0,&tolua_err)) ||
     !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
     !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,5,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  Drawable drawable = *((Drawable*)  tolua_tousertype(tolua_S,2,0));
  int width = ((int)  tolua_tonumber(tolua_S,3,0));
  int height = ((int)  tolua_tonumber(tolua_S,4,0));
  {
   cairo_xlib_surface_set_drawable(surface,drawable,width,height);
  }
 }
 return 0;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_set_drawable'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_display */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_display00
static int tolua_cairo_xlib_cairo_xlib_surface_get_display00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   Display* tolua_ret = (Display*)  cairo_xlib_surface_get_display(surface);
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Display");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_display'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_drawable */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_drawable00
static int tolua_cairo_xlib_cairo_xlib_surface_get_drawable00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   Drawable tolua_ret = (Drawable)  cairo_xlib_surface_get_drawable(surface);
   {
#ifdef __cplusplus
    void* tolua_obj = Mtolua_new((Drawable)(tolua_ret));
     tolua_pushusertype(tolua_S,tolua_obj,"Drawable");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
#else
    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Drawable));
     tolua_pushusertype(tolua_S,tolua_obj,"Drawable");
    tolua_register_gc(tolua_S,lua_gettop(tolua_S));
#endif
   }
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_drawable'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_screen */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_screen00
static int tolua_cairo_xlib_cairo_xlib_surface_get_screen00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   Screen* tolua_ret = (Screen*)  cairo_xlib_surface_get_screen(surface);
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Screen");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_screen'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_visual */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_visual00
static int tolua_cairo_xlib_cairo_xlib_surface_get_visual00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   Visual* tolua_ret = (Visual*)  cairo_xlib_surface_get_visual(surface);
    tolua_pushusertype(tolua_S,(void*)tolua_ret,"Visual");
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_visual'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_depth */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_depth00
static int tolua_cairo_xlib_cairo_xlib_surface_get_depth00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   int tolua_ret = (int)  cairo_xlib_surface_get_depth(surface);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_depth'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_width */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_width00
static int tolua_cairo_xlib_cairo_xlib_surface_get_width00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   int tolua_ret = (int)  cairo_xlib_surface_get_width(surface);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_width'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* function: cairo_xlib_surface_get_height */
#ifndef TOLUA_DISABLE_tolua_cairo_xlib_cairo_xlib_surface_get_height00
static int tolua_cairo_xlib_cairo_xlib_surface_get_height00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
 tolua_Error tolua_err;
 if (
     !tolua_isusertype(tolua_S,1,"cairo_surface_t",0,&tolua_err) ||
     !tolua_isnoobj(tolua_S,2,&tolua_err)
 )
  goto tolua_lerror;
 else
#endif
 {
  cairo_surface_t* surface = ((cairo_surface_t*)  tolua_tousertype(tolua_S,1,0));
  {
   int tolua_ret = (int)  cairo_xlib_surface_get_height(surface);
   tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
  }
 }
 return 1;
#ifndef TOLUA_RELEASE
 tolua_lerror:
 tolua_error(tolua_S,"#ferror in function 'cairo_xlib_surface_get_height'.",&tolua_err);
 return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE

/* Open function */
TOLUA_API int tolua_cairo_xlib_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  tolua_function(tolua_S,"cairo_xlib_surface_create",tolua_cairo_xlib_cairo_xlib_surface_create00);
  tolua_function(tolua_S,"cairo_xlib_surface_create_for_bitmap",tolua_cairo_xlib_cairo_xlib_surface_create_for_bitmap00);
  tolua_function(tolua_S,"cairo_xlib_surface_set_size",tolua_cairo_xlib_cairo_xlib_surface_set_size00);
  tolua_function(tolua_S,"cairo_xlib_surface_set_drawable",tolua_cairo_xlib_cairo_xlib_surface_set_drawable00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_display",tolua_cairo_xlib_cairo_xlib_surface_get_display00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_drawable",tolua_cairo_xlib_cairo_xlib_surface_get_drawable00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_screen",tolua_cairo_xlib_cairo_xlib_surface_get_screen00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_visual",tolua_cairo_xlib_cairo_xlib_surface_get_visual00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_depth",tolua_cairo_xlib_cairo_xlib_surface_get_depth00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_width",tolua_cairo_xlib_cairo_xlib_surface_get_width00);
  tolua_function(tolua_S,"cairo_xlib_surface_get_height",tolua_cairo_xlib_cairo_xlib_surface_get_height00);
 tolua_endmodule(tolua_S);
 return 1;
}


#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
 TOLUA_API int luaopen_cairo_xlib (lua_State* tolua_S) {
 return tolua_cairo_xlib_open(tolua_S);
}
#endif

