diff options
Diffstat (limited to 'src/lua5/imlua_image.c')
-rw-r--r-- | src/lua5/imlua_image.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c index 22ed38c..dc3322a 100644 --- a/src/lua5/imlua_image.c +++ b/src/lua5/imlua_image.c @@ -2,7 +2,7 @@ * \brief IM Lua 5 Binding * * See Copyright Notice in im_lib.h - * $Id: imlua_image.c,v 1.1 2008/10/17 06:16:32 scuri Exp $ + * $Id: imlua_image.c,v 1.2 2009/08/12 04:09:17 scuri Exp $ */ #include <string.h> @@ -437,6 +437,28 @@ static int imluaImageIsBitmap (lua_State *L) return 1; } + +/*****************************************************************************\ + image:GetOpenGLData() +\*****************************************************************************/ +static int imluaImageGetOpenGLData (lua_State *L) +{ + int format; + imbyte* gldata; + imImage *image = imlua_checkimage(L, 1); + + gldata = imImageGetOpenGLData(image, &format); + if (!gldata) + { + lua_pushnil(L); + return 1; + } + + lua_pushlightuserdata(L, gldata); + lua_pushinteger(L, format); + return 2; +} + /*****************************************************************************\ image:GetPalette() \*****************************************************************************/ @@ -551,6 +573,15 @@ static int imluaImageMakeBinary (lua_State *L) } /*****************************************************************************\ + image:MakeGray() +\*****************************************************************************/ +static int imluaImageMakeGray (lua_State *L) +{ + imImageMakeGray(imlua_checkimage(L, 1)); + return 0; +} + +/*****************************************************************************\ image:Width() \*****************************************************************************/ static int imluaImageWidth(lua_State *L) @@ -965,6 +996,7 @@ static const luaL_reg imimage_metalib[] = { {"GetAttributeList", imluaImageGetAttributeList}, {"Clear", imluaImageClear}, {"IsBitmap", imluaImageIsBitmap}, + {"GetOpenGLData", imluaImageGetOpenGLData}, {"SetPalette", imluaImageSetPalette}, {"GetPalette", imluaImageGetPalette}, {"CopyAttributes", imluaImageCopyAttributes}, @@ -975,6 +1007,7 @@ static const luaL_reg imimage_metalib[] = { {"Match", imluaImageMatch}, {"SetBinary", imluaImageSetBinary}, {"MakeBinary", imluaImageMakeBinary}, + {"MakeGray", imluaImageMakeGray}, {"Width", imluaImageWidth}, {"Height", imluaImageHeight}, {"Depth", imluaImageDepth}, |