From 16603e416317c65ccedb816e94de452ffcc9fdec Mon Sep 17 00:00:00 2001 From: scuri Date: Mon, 14 Feb 2011 20:52:41 +0000 Subject: *** empty log message *** --- src/lua5/cdlua5.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src') diff --git a/src/lua5/cdlua5.c b/src/lua5/cdlua5.c index a45bbd3..024ed6b 100644 --- a/src/lua5/cdlua5.c +++ b/src/lua5/cdlua5.c @@ -542,6 +542,27 @@ static int cdlua5_bitmapgetdata(lua_State *L) return 1; } +static int cdlua5_BitmapWidth(lua_State *L) +{ + cdBitmap* bitmap = cdlua_checkbitmap(L, 1); + lua_pushinteger(L, bitmap->w); + return 1; +} + +static int cdlua5_BitmapHeight(lua_State *L) +{ + cdBitmap* bitmap = cdlua_checkbitmap(L, 1); + lua_pushinteger(L, bitmap->h); + return 1; +} + +static int cdlua5_BitmapType(lua_State *L) +{ + cdBitmap* bitmap = cdlua_checkbitmap(L, 1); + lua_pushinteger(L, bitmap->type); + return 1; +} + static int cdlua5_bitmapsetrect(lua_State *L) { cdBitmap* bitmap = cdlua_checkbitmap(L, 1); @@ -1684,6 +1705,15 @@ static void initmetatables(lua_State *L) lua_pushliteral(L, "__tostring"); lua_pushcfunction(L, cdlua5_tostringbitmap); lua_settable(L, -3); + lua_pushliteral(L, "Width"); + lua_pushcfunction(L, cdlua5_BitmapWidth); + lua_settable(L, -3); + lua_pushliteral(L, "Height"); + lua_pushcfunction(L, cdlua5_BitmapHeight); + lua_settable(L, -3); + lua_pushliteral(L, "Type"); + lua_pushcfunction(L, cdlua5_BitmapType); + lua_settable(L, -3); lua_pop(L, 1); luaL_newmetatable(L, "cdImageRGB"); -- cgit v1.2.3