From 77a4608ee1f828ed70ec58588f0229cd57758148 Mon Sep 17 00:00:00 2001 From: scuri Date: Tue, 18 Aug 2009 02:21:01 +0000 Subject: *** empty log message *** --- src/lua5/im_fftw.lua | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/lua5/im_fftw.lua') 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 -- cgit v1.2.3