Skip to content

Commit

Permalink
antialias not work for local warping.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricporter committed Jul 14, 2012
1 parent 4be2389 commit 75a0e90
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions EffectLab/Effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,27 @@ def filter(self, img):
for y in range(height):
if sqrt((x - cx) ** 2 + (y - cy) ** 2) > r:
continue
u, v = self.warp(x, y, r, (cx, cy), (mx, my))
new_img.putpixel((x, y), img.getpixel((u, v)) )

found = 0
psum = (0, ) * nband
new_img.putpixel((x, y), (128, 128, 128, 255))

for ai in range(antialias):
for aj in range(antialias):
_x = x + ai
_y = y + aj

u, v = self.warp(_x, _y, r, (cx, cy), (mx, my))
u = int(round(u))
v = int(round(v))
pt = img.getpixel((u, v))
psum = map(operator.add, psum, pt)
found += 1

if found > 0:
psum = map(operator.div, psum, (antialias * antialias, ) * len(psum))
new_img.putpixel((x, y), tuple(psum))
# new_img.putpixel((x, y), img.getpixel((u, v)) )

return new_img

Expand Down

0 comments on commit 75a0e90

Please sign in to comment.