summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorscuri <scuri>2009-07-03 17:45:12 +0000
committerscuri <scuri>2009-07-03 17:45:12 +0000
commite91dd4dedeef0863cdfbc0be48f6c8a5ecd7c8df (patch)
treeda1f3c1d21871234b7cb34c85d0488516a75394d /src
parentd1139487842daba07e165e9c81ba703a87b1e9d4 (diff)
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/lua5/im_process.lua10
-rw-r--r--src/lua5/imlua_process.c110
2 files changed, 60 insertions, 60 deletions
diff --git a/src/lua5/im_process.lua b/src/lua5/im_process.lua
index 1d91d5e..fbe9534 100644
--- a/src/lua5/im_process.lua
+++ b/src/lua5/im_process.lua
@@ -30,7 +30,7 @@ end
local function TwoSourcesOneDest (funcname, width, height, color_space, data_type)
local func = im[funcname]
-
+
-- see if function is really defined
assert(func, string.format("undefined function `%s'", funcname))
@@ -148,12 +148,12 @@ function im.ProcessResizeNew (src_image, width, height)
return im.ProcessResize(src_image, dst_image), dst_image
end
-OneSourceOneDest("ProcessReduceBy4", function (image) return image:Width() / 2 end,
+OneSourceOneDest("ProcessReduceBy4", function (image) return image:Width() / 2 end,
function (image) return image:Height() / 2 end)
function im.ProcessCropNew (src_image, xmin, xmax, ymin, ymax)
local width = xmax - xmin + 1
- local height = xmax - ymin + 1
+ local height = ymax - ymin + 1
local dst_image = im.ImageCreateBased(src_image, width, height)
im.ProcessCrop(src_image, dst_image, xmin, ymin)
return dst_image
@@ -163,7 +163,7 @@ TwoSourcesOneDest("ProcessInsert")
function im.ProcessAddMarginsNew (src_image, xmin, xmax, ymin, ymax)
local width = xmax - xmin + 1
- local height = xmax - ymin + 1
+ local height = ymax - ymin + 1
local dst_image = im.ImageCreateBased(src_image, width, height)
im.ProcessAddMargins(src_image, dst_image, xmin, ymin)
return dst_image
@@ -217,7 +217,7 @@ function im.ProcessInterlaceSplitNew(src_image)
if math.mod(src_image:Height(), 2) then
dst_height1 = dst_height1 + 1
end
-
+
local dst_image1 = im.ImageCreateBased(src_image, nil, dst_height1)
local dst_image2 = im.ImageCreateBased(src_image, nil, src_image:Height()/2)
diff --git a/src/lua5/imlua_process.c b/src/lua5/imlua_process.c
index 1c77dac..6f08588 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.3 2009/06/24 20:42:29 scuri Exp $
+ * $Id: imlua_process.c,v 1.4 2009/07/03 17:45:13 scuri Exp $
*/
#include <memory.h>
@@ -606,8 +606,8 @@ static int imluaProcessReduceBy4 (lua_State *L)
imImage* dst_image = imlua_checkimage(L, 2);
imlua_matchcolor(L, src_image, dst_image);
- luaL_argcheck(L,
- dst_image->width == (src_image->width / 2) &&
+ luaL_argcheck(L,
+ dst_image->width == (src_image->width / 2) &&
dst_image->height == (src_image->height / 2), 3, "destiny image size must be source image width/2, height/2");
imProcessReduceBy4(src_image, dst_image);
@@ -626,9 +626,9 @@ static int imluaProcessCrop (lua_State *L)
imlua_matchcolor(L, src_image, dst_image);
luaL_argcheck(L, xmin >= 0 && xmin < src_image->width, 3, "xmin must be >= 0 and < width");
- luaL_argcheck(L, ymin >= 0 && ymin < src_image->height, 3, "ymin must be >= 0 and < height");
- luaL_argcheck(L, dst_image->width <= (src_image->width - xmin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin");
- luaL_argcheck(L, dst_image->height <= (src_image->height - ymin), 2, "destiny image size must be smaller than source image width-xmin, height-ymin");
+ luaL_argcheck(L, ymin >= 0 && ymin < src_image->height, 4, "ymin must be >= 0 and < height");
+ luaL_argcheck(L, dst_image->width <= (src_image->width - xmin), 2, "destiny image size must be smaller than source image width-xmin");
+ luaL_argcheck(L, dst_image->height <= (src_image->height - ymin), 2, "destiny image size must be smaller than source image height-ymin");
imProcessCrop(src_image, dst_image, xmin, ymin);
return 0;
@@ -722,9 +722,9 @@ static int imluaProcessRotateRef (lua_State *L)
imImage *dst_image = imlua_checkimage(L, 2);
double cos0 = (double) luaL_checknumber(L, 3);
double sin0 = (double) luaL_checknumber(L, 4);
- int x = luaL_checkint(L, 5);
- int y = luaL_checkint(L, 6);
- int to_origin = luaL_checkint(L, 7);
+ int x = luaL_checkint(L, 5);
+ int y = luaL_checkint(L, 6);
+ int to_origin = luaL_checkint(L, 7);
int order = luaL_checkint(L, 8);
imlua_matchcolor(L, src_image, dst_image);
@@ -741,8 +741,8 @@ static int imluaProcessRotate90 (lua_State *L)
{
imImage *src_image = imlua_checkimage(L, 1);
imImage *dst_image = imlua_checkimage(L, 2);
- int dir = luaL_checkint(L, 3);
-
+ int dir = luaL_checkint(L, 3);
+
imlua_matchcolor(L, src_image, dst_image);
luaL_argcheck(L, dst_image->width == src_image->height && dst_image->height == src_image->width, 2, "destiny width and height must have the source height and width");
luaL_argcheck(L, (dir == -1 || dir == 1), 3, "invalid dir, can be -1 or 1 only");
@@ -1234,7 +1234,7 @@ static int imluaProcessConvolve (lua_State *L)
lua_pushboolean(L, imProcessConvolve(src_image, dst_image, kernel));
return 1;
}
-
+
/*****************************************************************************\
im.ProcessConvolveDual
\*****************************************************************************/
@@ -1494,7 +1494,7 @@ static int imluaGaussianStdDev2KernelSize (lua_State *L)
/*****************************************************************************\
- Arithmetic Operations
+ Arithmetic Operations
\*****************************************************************************/
/*****************************************************************************\
@@ -1529,34 +1529,34 @@ static int imluaProcessArithmeticOp (lua_State *L)
switch (src_image1->data_type)
{
case IM_BYTE:
- luaL_argcheck(L,
- dst_image->data_type == IM_BYTE ||
- dst_image->data_type == IM_USHORT ||
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_BYTE ||
+ dst_image->data_type == IM_USHORT ||
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is byte, destiny image data type can be byte, ushort, int and float only.");
break;
case IM_USHORT:
- luaL_argcheck(L,
- dst_image->data_type == IM_USHORT ||
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_USHORT ||
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is ushort, destiny image data type can be ushort, int and float only.");
break;
case IM_INT:
- luaL_argcheck(L,
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is int, destiny image data type can be int and float only.");
break;
case IM_FLOAT:
- luaL_argcheck(L,
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_FLOAT,
2, "source image is float, destiny image data type can be float only.");
break;
case IM_CFLOAT:
- luaL_argcheck(L,
- dst_image->data_type == IM_CFLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_CFLOAT,
2, "source image is cfloat, destiny image data type can be cfloat only.");
break;
}
@@ -1580,34 +1580,34 @@ static int imluaProcessArithmeticConstOp (lua_State *L)
switch (src_image->data_type)
{
case IM_BYTE:
- luaL_argcheck(L,
- dst_image->data_type == IM_BYTE ||
- dst_image->data_type == IM_USHORT ||
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_BYTE ||
+ dst_image->data_type == IM_USHORT ||
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is byte, destiny image data type can be byte, ushort, int and float only.");
break;
case IM_USHORT:
- luaL_argcheck(L,
- dst_image->data_type == IM_USHORT ||
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_USHORT ||
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is ushort, destiny image data type can be ushort, int and float only.");
break;
case IM_INT:
- luaL_argcheck(L,
- dst_image->data_type == IM_INT ||
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_INT ||
+ dst_image->data_type == IM_FLOAT,
2, "source image is int, destiny image data type can be int and float only.");
break;
case IM_FLOAT:
- luaL_argcheck(L,
- dst_image->data_type == IM_FLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_FLOAT,
2, "source image is float, destiny image data type can be float only.");
break;
case IM_CFLOAT:
- luaL_argcheck(L,
- dst_image->data_type == IM_CFLOAT,
+ luaL_argcheck(L,
+ dst_image->data_type == IM_CFLOAT,
2, "source image is cfloat, destiny image data type can be cfloat only.");
break;
}
@@ -2299,16 +2299,16 @@ static int imluaProcessRenderConstant (lua_State *L)
int count = image->depth;
imlua_checknotcfloat(L, image, 1);
-
+
if (lua_istable(L, 2))
{
value = (float*) malloc (sizeof(float) * count);
-
+
for (i = 0; i < count; i++)
{
lua_rawgeti(L, 2, i+1);
value[i] = (float) lua_tonumber(L, -1);
- lua_pop(L, 1);
+ lua_pop(L, 1);
}
}
@@ -2536,10 +2536,10 @@ static int imluaProcessDirectConv (lua_State *L)
imImage *src_image = imlua_checkimage(L, 1);
imImage *dst_image = imlua_checkimage(L, 2);
- luaL_argcheck(L,
- src_image->data_type == IM_USHORT ||
+ luaL_argcheck(L,
+ src_image->data_type == IM_USHORT ||
src_image->data_type == IM_INT ||
- src_image->data_type == IM_FLOAT,
+ src_image->data_type == IM_FLOAT,
1, "data type can be ushort, int or float only");
imlua_checkdatatype(L, 2, dst_image, IM_BYTE);
imlua_matchsize(L, src_image, dst_image);
@@ -3063,18 +3063,18 @@ int imlua_open_process(lua_State *L)
#include "loh/im_process_be64.loh"
#else
#include "loh/im_process_be32.loh"
-#endif
+#endif
#else
#ifdef TEC_64
#ifdef WIN64
#include "loh/im_process_le64w.loh"
#else
#include "loh/im_process_le64.loh"
-#endif
+#endif
#else
#include "loh/im_process.loh"
-#endif
-#endif
+#endif
+#endif
imlua_open_kernel(L);
return 1;
}