summaryrefslogtreecommitdiff
path: root/src/lua5/imlua_process.c
diff options
context:
space:
mode:
authorscuri <scuri>2009-10-01 02:56:38 +0000
committerscuri <scuri>2009-10-01 02:56:38 +0000
commit62783aee16f96fe5e513fb230b8efddaa02981df (patch)
tree9dc512b0c758025c5cddba9709420f1bf9058675 /src/lua5/imlua_process.c
parent9a5e93213e08601a58725f44035ac622fb68e849 (diff)
New: functions imProcessUnsharp and imProcessSharp.
Changed: now imProcessUnArithmeticOp, imProcessArithmeticConstOp and imProcessArithmeticOp willl crop the result to 0-255 if destiny has data type byte. Changed: removed IM_UN_INC operation from imProcessUnArithmeticOp. It was not an unary operation. Can simply be done in place by imProcessArithmeticOp and IM_BIN_ADD.
Diffstat (limited to 'src/lua5/imlua_process.c')
-rw-r--r--src/lua5/imlua_process.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/src/lua5/imlua_process.c b/src/lua5/imlua_process.c
index fa6dc89..863c1d6 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.7 2009/09/28 20:19:09 scuri Exp $
+ * $Id: imlua_process.c,v 1.8 2009/10/01 02:56:58 scuri Exp $
*/
#include <memory.h>
@@ -1475,6 +1475,56 @@ static int imluaProcessCanny (lua_State *L)
}
/*****************************************************************************\
+ im.ProcessUnsharp
+\*****************************************************************************/
+static int imluaProcessUnsharp(lua_State *L)
+{
+ imImage *src_image = imlua_checkimage(L, 1);
+ imImage *dst_image = imlua_checkimage(L, 2);
+ float p1 = (float)luaL_checknumber(L, 3);
+ float p2 = (float)luaL_checknumber(L, 4);
+ float p3 = (float)luaL_checknumber(L, 5);
+
+ imlua_match(L, src_image, dst_image);
+
+ imProcessUnsharp(src_image, dst_image, p1, p2, p3);
+ return 0;
+}
+
+/*****************************************************************************\
+ im.ProcessSharp
+\*****************************************************************************/
+static int imluaProcessSharp(lua_State *L)
+{
+ imImage *src_image = imlua_checkimage(L, 1);
+ imImage *dst_image = imlua_checkimage(L, 2);
+ float p1 = (float)luaL_checknumber(L, 3);
+ float p2 = (float)luaL_checknumber(L, 4);
+
+ imlua_match(L, src_image, dst_image);
+
+ imProcessSharp(src_image, dst_image, p1, p2);
+ return 0;
+}
+
+/*****************************************************************************\
+ im.ProcessSharpKernel
+\*****************************************************************************/
+static int imluaProcessSharpKernel(lua_State *L)
+{
+ imImage *src_image = imlua_checkimage(L, 1);
+ imImage *kernel = imlua_checkimage(L, 2);
+ imImage *dst_image = imlua_checkimage(L, 3);
+ float p1 = (float)luaL_checknumber(L, 4);
+ float p2 = (float)luaL_checknumber(L, 5);
+
+ imlua_match(L, src_image, dst_image);
+
+ imProcessSharpKernel(src_image, kernel, dst_image, p1, p2);
+ return 0;
+}
+
+/*****************************************************************************\
im.GaussianStdDev2Repetitions
\*****************************************************************************/
static int imluaGaussianKernelSize2StdDev(lua_State *L)
@@ -2927,6 +2977,9 @@ static const luaL_reg improcess_lib[] = {
{"ProcessSplineEdgeConvolve", imluaProcessSplineEdgeConvolve},
{"ProcessZeroCrossing", imluaProcessZeroCrossing},
{"ProcessCanny", imluaProcessCanny},
+ {"ProcessUnsharp", imluaProcessUnsharp},
+ {"ProcessSharp", imluaProcessSharp},
+ {"ProcessSharpKernel", imluaProcessSharpKernel},
{"GaussianKernelSize2StdDev", imluaGaussianKernelSize2StdDev},
{"GaussianStdDev2KernelSize", imluaGaussianStdDev2KernelSize},
@@ -3013,7 +3066,6 @@ static const imlua_constant im_process_constants[] = {
{ "UN_EQL", IM_UN_EQL, NULL },
{ "UN_ABS", IM_UN_ABS, NULL },
{ "UN_LESS", IM_UN_LESS, NULL },
- { "UN_INC", IM_UN_INC, NULL },
{ "UN_INV", IM_UN_INV, NULL },
{ "UN_SQR", IM_UN_SQR, NULL },
{ "UN_SQRT", IM_UN_SQRT, NULL },