summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2011-02-14 20:52:41 +0000
committerscuri <scuri>2011-02-14 20:52:41 +0000
commit16603e416317c65ccedb816e94de452ffcc9fdec (patch)
treec1e31139f8ccf38002fee3f17436feb43cd3e2fa
parent3bbfd41908dd0b49414a6fe0d9da96cfb1360773 (diff)
*** empty log message ***
-rw-r--r--html/en/func/client.html6
-rw-r--r--src/lua5/cdlua5.c30
2 files changed, 33 insertions, 3 deletions
diff --git a/html/en/func/client.html b/html/en/func/client.html
index 93fd9b2..fa9ec5b 100644
--- a/html/en/func/client.html
+++ b/html/en/func/client.html
@@ -135,9 +135,9 @@ cd.RGB2Map(imagergb: cdImageRGB, imagemap: cdImageMap, palette: cdPalette) [in L
which will store the image. From this structure, the following fields are
officially defined:</p>
<pre>cdBitmap:
- int w /* image width */
- int h /* image heigth */
- int type /* image type: CD_RGBA, CD_RGB or CD_MAP */</pre>
+ int w -image width bitmap:Width() -&gt; w: number [in Lua]
+ int h -image heigth bitmap:Height() -&gt; h: number [in Lua]
+ int type -image type: CD_RGBA, CD_RGB or CD_MAP bitmap:Type() -&gt; type: number [in Lua]</pre>
<div class="function"><pre class="function"><span class="mainFunction">cdBitmap* <a name="cdCreateBitmap">cdCreateBitmap</a>(int w, int h, int type); [in C]</span>
cd.CreateBitmap(w, h, type: number) -&gt; (bitmap: cdBitmap) [in Lua]</pre>
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");