summaryrefslogtreecommitdiff
path: root/src/lua5/im_fftw.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua5/im_fftw.lua')
-rw-r--r--src/lua5/im_fftw.lua19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lua5/im_fftw.lua b/src/lua5/im_fftw.lua
index e57c7bf..7bae53e 100644
--- a/src/lua5/im_fftw.lua
+++ b/src/lua5/im_fftw.lua
@@ -3,6 +3,7 @@
-- Creates a new function, with the name suffixed by "New". This new function
-- creates a new image, based on a source image, and calls the previous function
-- with this new image.
+-- We assume here that the functions returns only one parameter or none.
local function OneSourceOneDest (funcname, width, height, color_space, data_type)
local func = im[funcname]
@@ -14,8 +15,12 @@ local function OneSourceOneDest (funcname, width, height, color_space, data_type
local dst_image = im.ImageCreateBased(src_image, width, height, color_space, data_type)
-- call previous method, repassing all parameters
- func(src_image, dst_image, unpack(arg))
- return dst_image
+ local ret = func(src_image, dst_image, unpack(arg))
+ if (ret) then
+ return ret, dst_image
+ else
+ return dst_image
+ end
end
end
@@ -25,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))
@@ -35,8 +40,12 @@ local function TwoSourcesOneDest (funcname, width, height, color_space, data_typ
local dst_image = im.ImageCreateBased(src_image1, width, height, color_space, data_type)
-- call previous method, repassing all parameters
- func(src_image1, src_image2, dst_image, unpack(arg))
- return dst_image
+ local ret = func(src_image1, src_image2, dst_image, unpack(arg))
+ if (ret) then
+ return ret, dst_image
+ else
+ return dst_image
+ end
end
end