From 5243eb5ec7e8f603619659607b4d74f6a76849c7 Mon Sep 17 00:00:00 2001 From: Cedric Porter Date: Sat, 14 Jul 2012 23:42:58 +0800 Subject: [PATCH] local warp anti-alias. You have to think clearly! --- EffectLab/Effect.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/EffectLab/Effect.py b/EffectLab/Effect.py index 89c1bfc..2296238 100755 --- a/EffectLab/Effect.py +++ b/EffectLab/Effect.py @@ -53,7 +53,7 @@ def filter(self, img): f = lambda x, y: (x, y) nband = len(img.getpixel((0, 0))) - antialias = 1 + antialias = 4 for x in range(width): for y in range(height): if sqrt((x - cx) ** 2 + (y - cy) ** 2) > r: @@ -61,12 +61,11 @@ def filter(self, img): found = 0 psum = (0, ) * nband - # new_img.putpixel((x, y), (128, 128, 128, 255)) for ai in range(antialias): - _x = x + ai + _x = x + ai / float(antialias) for aj in range(antialias): - _y = y + aj + _y = y + aj / float(antialias) u, v = self.warp(_x, _y, r, (cx, cy), (mx, my)) u = int(round(u))