From 66fa045682b16cb07b5b329dbd97fdf4b15771f1 Mon Sep 17 00:00:00 2001 From: Cedric Porter Date: Mon, 30 Jul 2012 14:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=8F=E6=98=8E=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EffectLab/Effect.py | 2 +- EffectLab/core.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/EffectLab/Effect.py b/EffectLab/Effect.py index df946cd..f7fe5ff 100755 --- a/EffectLab/Effect.py +++ b/EffectLab/Effect.py @@ -302,7 +302,7 @@ def transform(self, x, y, width, height, delta_w, delta_h): return x, y + offset def filter(self, img): - return core.wave_warp(img, self.dw, self.dh, self.antialias) + return core.wave_warp(img, self.dw, self.dh, self.antialias, self.empty_color) width, height = img.size diff --git a/EffectLab/core.c b/EffectLab/core.c index 28fda2f..4ebd179 100644 --- a/EffectLab/core.c +++ b/EffectLab/core.c @@ -256,12 +256,13 @@ static PyObject* wave_warp(PyObject *self, PyObject *args) double xnew, ynew; UINT8 *pixel; int i3, j3; - PyObject *ret; + PyObject *ret, *empty_color; double dw = 1, dh=0.3; double radian; double offset; + int er, eg, eb, ea; - if (!PyArg_ParseTuple(args, "Oddi", &image, &dw, &dh, &antialias)) + if (!PyArg_ParseTuple(args, "OddiO", &image, &dw, &dh, &antialias, &empty_color)) { return NULL; } @@ -280,6 +281,11 @@ static PyObject* wave_warp(PyObject *self, PyObject *args) } imOut = core->image; + if (!PyArg_ParseTuple(empty_color, "iiii", &er, &eg, &eb, &ea)) + { + return 0; + } + width = imIn->xsize; height = imIn->ysize; @@ -295,10 +301,10 @@ static PyObject* wave_warp(PyObject *self, PyObject *args) pixel = imOut->image[j]; pixel += i * 4; - pixel[0] = 128; - pixel[1] = 128; - pixel[2] = 128; - pixel[3] = 128; + pixel[0] = er; + pixel[1] = eg; + pixel[2] = eb; + pixel[3] = ea; for (ai = 0; ai < antialias; ai++) {