diff options
author | scuri <scuri> | 2010-10-25 18:29:06 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-10-25 18:29:06 +0000 |
commit | b007c2695ead1e484cf327765c47d8346f632447 (patch) | |
tree | 383fa5243f5fc20349f3e7f79b6fcf079e8378e9 /src/lua5 | |
parent | aff7346948dc33cf2ebb22ed7ef1b93796c85ce7 (diff) |
*** empty log message ***
Diffstat (limited to 'src/lua5')
-rw-r--r-- | src/lua5/imlua_image.c | 17 | ||||
-rw-r--r-- | src/lua5/imlua_palette.c | 12 | ||||
-rw-r--r-- | src/lua5/imlua_util.c | 8 |
3 files changed, 26 insertions, 11 deletions
diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c index 5f84b97..b8bc1a8 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.12 2010/07/18 03:04:23 scuri Exp $ + * $Id: imlua_image.c,v 1.13 2010/10/25 18:29:07 scuri Exp $ */ #include <string.h> @@ -119,6 +119,20 @@ static int imluaImageCreate (lua_State *L) } /*****************************************************************************\ + im.ImageCreateFromOpenGLData(width, height, glformat, gldata) +\*****************************************************************************/ +static int imluaImageCreateFromOpenGLData (lua_State *L) +{ + int width = luaL_checkint(L, 1); + int height = luaL_checkint(L, 2); + int glformat = luaL_checkint(L, 3); + void* gldata = lua_touserdata(L, 4); + imImage *image = imImageCreateFromOpenGLData(width, height, glformat, gldata); + imlua_pushimage(L, image); + return 1; +} + +/*****************************************************************************\ image:AddAlpha() \*****************************************************************************/ static int imluaImageAddAlpha (lua_State *L) @@ -1014,6 +1028,7 @@ static int imluaImage_index (lua_State *L) static const luaL_reg imimage_lib[] = { {"ImageCreate", imluaImageCreate}, + {"ImageCreateFromOpenGLData", imluaImageCreateFromOpenGLData}, {"ImageDestroy", imluaImageDestroy}, {"FileImageLoad", imluaFileImageLoad}, {"FileImageLoadBitmap", imluaFileImageLoadBitmap}, diff --git a/src/lua5/imlua_palette.c b/src/lua5/imlua_palette.c index 135fe9a..029374c 100644 --- a/src/lua5/imlua_palette.c +++ b/src/lua5/imlua_palette.c @@ -2,7 +2,7 @@ * \brief IM Lua 5 Binding * * See Copyright Notice in im_lib.h - * $Id: imlua_palette.c,v 1.2 2010/06/11 17:43:52 scuri Exp $ + * $Id: imlua_palette.c,v 1.3 2010/10/25 18:29:07 scuri Exp $ */ #include <string.h> @@ -91,7 +91,7 @@ static int imluaPaletteCreate(lua_State *L) static int imluaPaletteFindNearest (lua_State *L) { imluaPalette *pal = imlua_checkpalette(L, 1); - long color = (long int) lua_touserdata(L, 1); + long color = (long)lua_touserdata(L, 1); lua_pushnumber(L, imPaletteFindNearest(pal->color, pal->count, color)); return 1; @@ -103,7 +103,7 @@ static int imluaPaletteFindNearest (lua_State *L) static int imluaPaletteFindColor (lua_State *L) { imluaPalette *pal = imlua_checkpalette(L, 1); - long color = (long) lua_touserdata(L, 2); + long color = (long)lua_touserdata(L, 2); unsigned char tol = (unsigned char)luaL_checkint(L, 3); lua_pushnumber(L, imPaletteFindColor(pal->color, pal->count, color, tol)); @@ -241,7 +241,7 @@ static int imluaPaletteUniform (lua_State *L) \*****************************************************************************/ static int imluaPaletteUniformIndex (lua_State *L) { - lua_pushnumber(L, imPaletteUniformIndex((long int) lua_touserdata(L, 1))); + lua_pushnumber(L, imPaletteUniformIndex((long)lua_touserdata(L, 1))); return 1; } @@ -250,7 +250,7 @@ static int imluaPaletteUniformIndex (lua_State *L) \*****************************************************************************/ static int imluaPaletteUniformIndexHalftoned (lua_State *L) { - long color = (long) lua_touserdata(L, 1); + long color = (long)lua_touserdata(L, 1); int x = luaL_checkint(L, 2); int y = luaL_checkint(L, 3); @@ -321,7 +321,7 @@ static int imluaPalette_newindex(lua_State *L) if (!lua_islightuserdata(L, 3)) luaL_argerror(L, 3, "color must be a light user data"); - color_i = (long int) lua_touserdata(L, 3); + color_i = (long)lua_touserdata(L, 3); pal->color[index_i] = color_i; return 0; diff --git a/src/lua5/imlua_util.c b/src/lua5/imlua_util.c index 69cfb19..c07d920 100644 --- a/src/lua5/imlua_util.c +++ b/src/lua5/imlua_util.c @@ -2,7 +2,7 @@ * \brief IM Lua 5 Binding * * See Copyright Notice in im_lib.h - * $Id: imlua_util.c,v 1.1 2008/10/17 06:16:32 scuri Exp $ + * $Id: imlua_util.c,v 1.2 2010/10/25 18:29:07 scuri Exp $ */ #include "im.h" @@ -199,7 +199,7 @@ static int imlua_colorencode(lua_State *L) { int red_f, green_f, blue_f; unsigned char red_i, green_i, blue_i; - long int color_i; + long color_i; red_f = luaL_checkint(L, 1); green_f = luaL_checkint(L, 2); @@ -228,13 +228,13 @@ static int imlua_colorencode(lua_State *L) \***************************************************************************/ static int imlua_colordecode(lua_State *L) { - long int color_i; + long color_i; unsigned char red_i, green_i, blue_i; if (!lua_islightuserdata(L, 1)) luaL_argerror(L, 1, "color must be a light user data"); - color_i = (long int) lua_touserdata(L,1); + color_i = (long)lua_touserdata(L,1); imColorDecode(&red_i, &green_i, &blue_i, color_i); lua_pushnumber(L, red_i); |