Esempio n. 1
0
static int new_Win32PrintingSurface (lua_State *L)
{
    HDC hdc;
    cairo_surface_t *cs;
    lua_remove(L, 1); // remove cairo.Win32PrintingSurface

    //{"create",                                   l_cairo_win32_printing_surface_create},
    hdc = (HDC) check_lightuserdata(L, 1);
    cs = cairo_win32_printing_surface_create(hdc);

    return new_Surface(L, LUACAIRO ".Win32PrintingSurface.mt", cs, CAIRO_SURFACE_TYPE_WIN32_PRINTING, 1);
}
Esempio n. 2
0
static int new_RegionFromLUD (lua_State *L)
{
    cairo_region_t *reg = (cairo_region_t *) check_lightuserdata(L, 1);
    int havereg  = lua_toboolean(L, 2);

    Region *o = (Region *) lua_newuserdata(L, sizeof(Region));
    o->reg_     = reg;
    o->havereg_ = havereg;

    luaL_getmetatable(L, LUACAIRO ".Region.mt");
    lua_setmetatable(L, -2);

    return 1;
}
Esempio n. 3
0
static int new_DeviceFromLUD (lua_State *L)
{
    cairo_device_t *dev = (cairo_device_t *) check_lightuserdata(L, 1);
    int havedev  = lua_toboolean(L, 2);

    Device *o = (Device *) lua_newuserdata(L, sizeof(Device));
    o->dev_     = dev;
    o->havedev_ = havedev;

    luaL_getmetatable(L, LUACAIRO ".Device.mt");
    lua_setmetatable(L, -2);

    return 1;
}
static int new_FontOptionsFromLUD (lua_State *L)
{
    cairo_font_options_t *fo = (cairo_font_options_t *) check_lightuserdata(L, 1);
    int havefo  = lua_toboolean(L, 2);

    FontOptions *o = (FontOptions *) lua_newuserdata(L, sizeof(FontOptions));
    o->fo_     = fo;
    o->havefo_ = havefo;

    luaL_getmetatable(L, LUACAIRO ".FontOptions.mt");
    lua_setmetatable(L, -2);

    return 1;
}
Esempio n. 5
0
static int new_ContextFromLUD (lua_State *L)
{
    cairo_t *cr = (cairo_t *) check_lightuserdata(L, 1);
    int havecr  = lua_toboolean(L, 2);

    Context *o = (Context *) lua_newuserdata(L, sizeof(Context));
    o->cr_     = cr;
    o->havecr_ = havecr;

    luaL_getmetatable(L, LUACAIRO ".Context.mt");
    lua_setmetatable(L, -2);

    return 1;
}
Esempio n. 6
0
static int new_Win32Surface (lua_State *L)
{
    HDC hdc;
    cairo_surface_t *cs;

    lua_remove(L, 1); // remove cairo.Win32Surface

    //FIXME
    //{"create_with_ddb",                          l_cairo_win32_surface_create_with_ddb},
    //{"create_with_dib",                          l_cairo_win32_surface_create_with_dib},

    //{"create",                                   l_cairo_win32_surface_create},
    hdc = (HDC) check_lightuserdata(L, 1);
    cs = cairo_win32_surface_create(hdc);

    return new_Surface(L, LUACAIRO ".Win32Surface.mt", cs, CAIRO_SURFACE_TYPE_WIN32, 1);
}
Esempio n. 7
0
//FIXME should not be exposed to the user of the language binding,
//FIXME but rather used to implement memory management within the language binding
// cairo_public void
// cairo_font_face_destroy (cairo_font_face_t *font_face);
static int l_cairo_font_face_destroy(lua_State* L)
{
    cairo_font_face_t *font_face = (cairo_font_face_t *) check_lightuserdata(L, 1);
    cairo_font_face_destroy (font_face);
    return 0;
}