diff options
author | scuri <scuri> | 2010-05-26 18:29:48 +0000 |
---|---|---|
committer | scuri <scuri> | 2010-05-26 18:29:48 +0000 |
commit | c196148fb2fd001a16434c46427d7651e5abb7f2 (patch) | |
tree | 652fa3f9e6e96a587169daba800dedd67d5a702a | |
parent | d10c0cb34f483d5189ea70152babeabd0b89b546 (diff) |
# Fixed: image:HasAlpha() method in Lua was returning a number instead of a boolean, so im.ImageCreateBased was adding an alpha channel to all new images.
-rw-r--r-- | html/en/history.html | 5 | ||||
-rw-r--r-- | include/im_image.h | 2 | ||||
-rw-r--r-- | src/lua5/imlua_image.c | 8 |
3 files changed, 10 insertions, 5 deletions
diff --git a/html/en/history.html b/html/en/history.html index 1b815be..f25b10f 100644 --- a/html/en/history.html +++ b/html/en/history.html @@ -21,6 +21,11 @@ <li dir="ltr"> <span style="color: #008000">Changed:</span> ICON format now supports writing up to 10 images.</li> + <li dir="ltr"> + <span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span + style="color: #000000"> image:<strong>HasAlpha</strong>() method in + Lua was returning a number instead of a boolean, so <strong>im</strong>.<strong>ImageCreateBased</strong> + was adding an alpha channel to all new images.</span></span></li> </ul> <h3 dir="ltr"> <a href="http://sourceforge.net/projects/imtoolkit/files/3.6.1/">Version 3.6.1</a> (23/Apr/2010)</h3> diff --git a/include/im_image.h b/include/im_image.h index 6a325c1..e795479 100644 --- a/include/im_image.h +++ b/include/im_image.h @@ -41,7 +41,7 @@ typedef struct _imImage int height; /**< Number of lines. image:Height() -> height: number [in Lua 5]. */ int color_space; /**< Color space descriptor. See also \ref imColorSpace. image:ColorSpace() -> color_space: number [in Lua 5]. */ int data_type; /**< Data type descriptor. See also \ref imDataType. image:DataType() -> data_type: number [in Lua 5]. */ - int has_alpha; /**< Indicates that there is an extra channel with alpha. image:HasAlpha() -> has_alpha: number [in Lua 5]. \n + int has_alpha; /**< Indicates that there is an extra channel with alpha. image:HasAlpha() -> has_alpha: boolean [in Lua 5]. \n It will not affect the secondary parameters, i.e. the number of planes will be in fact depth+1. \n It is always 0 unless imImageAddAlpha is called, this is done in image load functions. */ diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c index 9900e7d..a95007e 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.9 2010/01/17 18:18:12 scuri Exp $ + * $Id: imlua_image.c,v 1.10 2010/05/26 18:29:49 scuri Exp $ */ #include <string.h> @@ -674,7 +674,7 @@ static int imluaImageColorSpace(lua_State *L) static int imluaImageHasAlpha(lua_State *L) { imImage *im = imlua_checkimage(L, 1); - lua_pushnumber(L, im->has_alpha); + lua_pushboolean(L, im->has_alpha); return 1; } @@ -785,14 +785,14 @@ static int imluaImage_tostring (lua_State *L) if (*image_p) { imImage *image = *image_p; - lua_pushfstring(L, "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d,has_alpha=%d]", + lua_pushfstring(L, "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d,has_alpha=%s]", image_p, image->width, image->height, imColorModeSpaceName(image->color_space), imDataTypeName(image->data_type), image->depth, - image->has_alpha + image->has_alpha? "yes": "no" ); } else |