diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index dd7f12a0f..db04fefc6 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -28,6 +28,7 @@ #include #ifdef MARTII #include +#include #endif #include @@ -346,6 +347,8 @@ const luaL_Reg CLuaInstance::methods[] = { "GetInput", CLuaInstance::GetInput }, { "FontHeight", CLuaInstance::FontHeight }, #ifdef MARTII + { "GetSize", CLuaInstance::GetSize }, + { "DisplayImage", CLuaInstance::DisplayImage }, { "Blit", CLuaInstance::Blit }, { "GetLanguage", CLuaInstance::GetLanguage }, #endif @@ -513,6 +516,41 @@ int CLuaInstance::PaintIcon(lua_State *L) return 0; } +#ifdef MARTII +extern CPictureViewer * g_PicViewer; + +int CLuaInstance::DisplayImage(lua_State *L) +{ + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + int x, y, w, h; + const char *fname; + + fname = luaL_checkstring(L, 2); + x = luaL_checkint(L, 3); + y = luaL_checkint(L, 4); + w = luaL_checkint(L, 5); + h = luaL_checkint(L, 6); + int trans = 0; + if (lua_isnumber(L, 7)) + trans = luaL_checkint(L, 7); + g_PicViewer->DisplayImage(fname, x, y, w, h, trans); + return 0; +} + +int CLuaInstance::GetSize(lua_State *L) +{ + DBG("CLuaInstance::%s %d\n", __func__, lua_gettop(L)); + int w = 0, h = 0; + const char *fname; + + fname = luaL_checkstring(L, 2); + g_PicViewer->getSize(fname, &w, &h); + lua_pushinteger(L, w); + lua_pushinteger(L, h); + return 2; +} +#endif + int CLuaInstance::RenderString(lua_State *L) { int x, y, w, boxh, f, center; diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 301cfc059..d20f20164 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -152,6 +152,8 @@ private: #ifdef MARTII static int Blit(lua_State *L); static int GetLanguage(lua_State *L); + static int GetSize(lua_State *L); + static int DisplayImage(lua_State *L); void MenueRegister(lua_State *L); static int MenueNew(lua_State *L);