summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorscuri <scuri>2010-01-06 20:15:34 +0000
committerscuri <scuri>2010-01-06 20:15:34 +0000
commitf7cb3c864a65132c672da90a81627e49c98a1ca9 (patch)
tree61c2180524f77ffcf4c89e8aedecbd9a949ebfcf
parent0555ad520a43e046c7a5b71a116ddc72e4530142 (diff)
*** empty log message ***
-rw-r--r--html/en/copyright.html2
-rw-r--r--html/en/history.html8
-rw-r--r--src/lua5/imlua_image.c17
-rw-r--r--src/lua5/imlua_process.c24
-rw-r--r--src/process/im_color.cpp6
5 files changed, 35 insertions, 22 deletions
diff --git a/html/en/copyright.html b/html/en/copyright.html
index de91c03..4bfb681 100644
--- a/html/en/copyright.html
+++ b/html/en/copyright.html
@@ -25,7 +25,7 @@ a Tecgraf logo and a link to our site in a web page for your product. </p>
from licensed software. The library was developed by request of Petrobras. Petrobras permits Tecgraf to distribute the
library under the conditions here presented.</p>
<hr>
-<p>Copyright © 1994-2009 <a HREF="http://www.tecgraf.puc-rio.br">Tecgraf</a>, <a HREF="http://www.puc-rio.br">PUC-Rio</a>.</p>
+<p>Copyright © 1994-2010 <a HREF="http://www.tecgraf.puc-rio.br">Tecgraf</a>, <a HREF="http://www.puc-rio.br">PUC-Rio</a>.</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
diff --git a/html/en/history.html b/html/en/history.html
index 47bd86d..38ec86a 100644
--- a/html/en/history.html
+++ b/html/en/history.html
@@ -12,7 +12,7 @@
<h2>History of Changes</h2>
<h3 dir="ltr">
- CVS (25/Dec/2009)</h3>
+ CVS (04/Jan/2010)</h3>
<ul dir="ltr">
<li><span style="color: #0000FF">New:</span> function <strong>
imImageCopyPlane</strong>.</li>
@@ -24,6 +24,12 @@
imAnalyzeFindRegions</strong> when more than 16k regions where found.</span></span></li>
<li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
style="color: #000000"> memory leak in <strong>imFileOpen</strong>.</span></span></li>
+ <li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
+ style="color: #000000"> alpha support in <strong>
+ imProcessSplitComponents</strong> and <strong>imProcessMergeComponents</strong>.</span></span></li>
+ <li dir="ltr"><span style="color: #008000"><span style="color: #ff0000">Fixed:</span><span
+ style="color: #000000"> alpha support in image:<strong>CopyPlane</strong>()
+ and in channel indexing in Lua.</span></span></li>
</ul>
<h3 dir="ltr">
<a href="http://sourceforge.net/projects/imtoolkit/files/3.5/">Version 3.5</a> (02/Oct/2009)</h3>
diff --git a/src/lua5/imlua_image.c b/src/lua5/imlua_image.c
index 32a3080..dcb1647 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.6 2009/12/25 22:43:50 scuri Exp $
+ * $Id: imlua_image.c,v 1.7 2010/01/06 20:16:29 scuri Exp $
*/
#include <string.h>
@@ -175,13 +175,16 @@ static int imluaImageCopyPlane(lua_State *L)
int src_plane = luaL_checkint(L, 2);
imImage* dst_image = imlua_checkimage(L, 3);
int dst_plane = luaL_checkint(L, 4);
+ int src_depth, dst_depth;
imlua_match(L, src_image, dst_image);
- if (src_plane < 0 || src_plane >= src_image->depth)
+ src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ if (src_plane < 0 || src_plane >= src_depth)
luaL_argerror(L, 2, "invalid source channel, out of bounds");
- if (dst_plane < 0 || dst_plane >= dst_image->depth)
+ dst_depth = dst_image->has_alpha? dst_image->depth+1: dst_image->depth;
+ if (dst_plane < 0 || dst_plane >= dst_depth)
luaL_argerror(L, 4, "invalid destiny channel, out of bounds");
imImageCopyPlane(src_image, src_plane, dst_image, dst_plane);
@@ -773,13 +776,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]",
+ lua_pushfstring(L, "imImage(%p) [width=%d,height=%d,color_space=%s,data_type=%s,depth=%d,has_alpha=%d]",
image_p,
image->width,
image->height,
imColorModeSpaceName(image->color_space),
imDataTypeName(image->data_type),
- image->depth
+ image->depth,
+ image->has_alpha
);
}
else
@@ -978,7 +982,8 @@ static int imluaImage_index (lua_State *L)
int channel = luaL_checkint(L, 2);
/* create channel */
- if (channel < 0 || channel >= image->depth)
+ int depth = image->has_alpha? image->depth+1: image->depth;
+ if (channel < 0 || channel >= depth)
luaL_argerror(L, 2, "invalid channel, out of bounds");
imlua_newimagechannel(L, image, channel);
diff --git a/src/lua5/imlua_process.c b/src/lua5/imlua_process.c
index 863c1d6..198d0e5 100644
--- a/src/lua5/imlua_process.c
+++ b/src/lua5/imlua_process.c
@@ -2,7 +2,7 @@
* \brief IM Lua 5 Binding
*
* See Copyright Notice in im_lib.h
- * $Id: imlua_process.c,v 1.8 2009/10/01 02:56:58 scuri Exp $
+ * $Id: imlua_process.c,v 1.9 2010/01/06 20:16:30 scuri Exp $
*/
#include <memory.h>
@@ -2009,18 +2009,19 @@ static int imluaProcessMergeHSI (lua_State *L)
\*****************************************************************************/
static int imluaProcessSplitComponents (lua_State *L)
{
- int i;
+ int i, src_depth;
imImage *src_image = imlua_checkimage(L, 1);
imImage **dst_image_list;
luaL_checktype(L, 2, LUA_TTABLE);
- if (imlua_getn(L, 2) != src_image->depth)
+ src_depth = src_image->has_alpha? src_image->depth+1: src_image->depth;
+ if (imlua_getn(L, 2) != src_depth)
luaL_error(L, "number of destiny images must match the depth of the source image");
- dst_image_list = (imImage**)malloc(sizeof(imImage*)*src_image->depth);
+ dst_image_list = (imImage**)malloc(sizeof(imImage*)*src_depth);
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
lua_pushnumber(L, i+1);
lua_gettable(L, 2);
@@ -2029,7 +2030,7 @@ static int imluaProcessSplitComponents (lua_State *L)
lua_pop(L, 1);
}
- for (i = 0; i < src_image->depth; i++)
+ for (i = 0; i < src_depth; i++)
{
int check = imImageMatchDataType(src_image, dst_image_list[i]);
if (!check) free(dst_image_list);
@@ -2048,19 +2049,20 @@ static int imluaProcessSplitComponents (lua_State *L)
\*****************************************************************************/
static int imluaProcessMergeComponents (lua_State *L)
{
- int i;
+ int i, dst_depth;
imImage** src_image_list;
imImage *dst_image;
luaL_checktype(L, 1, LUA_TTABLE);
dst_image = imlua_checkimage(L, 2);
- if (imlua_getn(L, 1) != dst_image->depth)
+ dst_depth = dst_image->has_alpha? dst_image->depth+1: dst_image->depth;
+ if (imlua_getn(L, 1) != dst_depth)
luaL_error(L, "number of source images must match the depth of the destination image");
- src_image_list = (imImage**)malloc(sizeof(imImage*)*dst_image->depth);
+ src_image_list = (imImage**)malloc(sizeof(imImage*)*dst_depth);
- for (i = 0; i < dst_image->depth; i++)
+ for (i = 0; i < dst_depth; i++)
{
lua_pushnumber(L, i+1);
lua_gettable(L, 1);
@@ -2069,7 +2071,7 @@ static int imluaProcessMergeComponents (lua_State *L)
lua_pop(L, 1);
}
- for (i = 0; i < dst_image->depth; i++)
+ for (i = 0; i < dst_depth; i++)
{
int check = imImageMatchDataType(src_image_list[i], dst_image);
if (!check) free(src_image_list);
diff --git a/src/process/im_color.cpp b/src/process/im_color.cpp
index b27d4b3..29933c4 100644
--- a/src/process/im_color.cpp
+++ b/src/process/im_color.cpp
@@ -2,7 +2,7 @@
* \brief Color Processing Operations
*
* See Copyright Notice in im_lib.h
- * $Id: im_color.cpp,v 1.1 2008/10/17 06:16:33 scuri Exp $
+ * $Id: im_color.cpp,v 1.2 2010/01/06 20:16:30 scuri Exp $
*/
#include <im.h>
@@ -142,7 +142,7 @@ void imProcessSplitComponents(const imImage* src_image, imImage** dst_image)
memcpy(dst_image[0]->data[0], src_image->data[0], src_image->plane_size);
memcpy(dst_image[1]->data[0], src_image->data[1], src_image->plane_size);
memcpy(dst_image[2]->data[0], src_image->data[2], src_image->plane_size);
- if (imColorModeDepth(src_image->color_space) == 4)
+ if (imColorModeDepth(src_image->color_space) == 4 || src_image->has_alpha)
memcpy(dst_image[3]->data[0], src_image->data[3], src_image->plane_size);
}
@@ -151,7 +151,7 @@ void imProcessMergeComponents(const imImage** src_image, imImage* dst_image)
memcpy(dst_image->data[0], src_image[0]->data[0], dst_image->plane_size);
memcpy(dst_image->data[1], src_image[1]->data[0], dst_image->plane_size);
memcpy(dst_image->data[2], src_image[2]->data[0], dst_image->plane_size);
- if (imColorModeDepth(dst_image->color_space) == 4)
+ if (imColorModeDepth(dst_image->color_space) == 4 || dst_image->has_alpha)
memcpy(dst_image->data[3], src_image[3]->data[0], dst_image->plane_size);
}