aboutsummaryrefslogtreecommitdiff
path: root/src/lua/graphics/luaopen_Image.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-14 14:56:47 +0800
committerchai <chaifix@163.com>2018-08-14 14:56:47 +0800
commit5c9af043503f92852a1a765b6ecfbc1aea24d2e9 (patch)
treeeb371092c4137a672e7bfc13dc56ee777623ebfe /src/lua/graphics/luaopen_Image.cpp
parent5162f84be0a4deb447c6ba1226722b049335d525 (diff)
*update
Diffstat (limited to 'src/lua/graphics/luaopen_Image.cpp')
-rw-r--r--src/lua/graphics/luaopen_Image.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lua/graphics/luaopen_Image.cpp b/src/lua/graphics/luaopen_Image.cpp
index 0f97b2c..8d89a80 100644
--- a/src/lua/graphics/luaopen_Image.cpp
+++ b/src/lua/graphics/luaopen_Image.cpp
@@ -1,39 +1,40 @@
#include "lua/luax.h"
-#include "libjin/jin.h"
#include "lua/luaopen_types.h"
+#include "Image.h"
+#include "Color.h"
namespace jin
{
namespace lua
{
- using namespace jin::graphics;
+ using namespace lua::graphics;
- static inline Texture* checkTexture(lua_State* L)
+ static inline Image* checkImage(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_IMAGE);
if (proxy != nullptr)
- return (Texture*)proxy->object;
+ return (Image*)proxy->object;
return nullptr;
}
static int l_getWidth(lua_State* L)
{
- Texture* i = checkTexture(L);
+ Image* i = checkImage(L);
luax_pushnumber(L, i->getWidth());
return 1;
}
static int l_getHeight(lua_State *L)
{
- Texture* i = checkTexture(L);
+ Image* i = checkImage(L);
luax_pushnumber(L, i->getHeight());
return 1;
}
static int l_getPixel(lua_State* L)
{
- Texture* i = checkTexture(L);
+ Image* i = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
color c = i->getPixel(x, y);
@@ -46,7 +47,7 @@ namespace lua
static int l_setAnchor(lua_State* L)
{
- Texture* i = checkTexture(L);
+ Image* i = checkImage(L);
int x = luax_checknumber(L, 2);
int y = luax_checknumber(L, 3);
i->setAnchor(x, y);
@@ -55,7 +56,7 @@ namespace lua
static int l_getSize(lua_State* L)
{
- Texture* i = checkTexture(L);
+ Image* i = checkImage(L);
luax_pushnumber(L, i->getWidth());
luax_pushnumber(L, i->getHeight());
return 2;
@@ -64,8 +65,7 @@ namespace lua
static int l_gc(lua_State* L)
{
Proxy* proxy = (Proxy*)luax_checktype(L, 1, JIN_GRAPHICS_IMAGE);
- Texture* img = (Texture*)proxy->object;
- delete img;
+ proxy->release();
return 0;
}