Skip to content

Commit

Permalink
透明色
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricporter committed Jul 30, 2012
1 parent 9b7efa9 commit 66fa045
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion EffectLab/Effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 12 additions & 6 deletions EffectLab/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;

Expand All @@ -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++)
{
Expand Down

0 comments on commit 66fa045

Please sign in to comment.