0

changed most PIL paste() calls into composite.alpha_over() calls

The ones I have not changed are those where paste() is really
preferred, and I've noted why in comments.

Calls to "dest.paste(src, rect, mask)" were converted to calls to
"composite.alpha_over(dest, src, rect, mask)".
This commit is contained in:
Aaron Griffith
2010-10-23 13:36:55 -04:00
parent 8120bcd455
commit 395e26ef9c
3 changed files with 61 additions and 49 deletions

View File

@@ -29,6 +29,7 @@ import util
from PIL import Image
from optimizeimages import optimize_image
import composite
"""
@@ -449,7 +450,10 @@ def render_innertile(dest, name, imgformat, optimizeimg):
# Create the actual image now
img = Image.new("RGBA", (384, 384), (38,92,255,0))
# we'll use paste (NOT alpha_over) for quadtree generation because
# this is just straight image stitching, not alpha blending
if q0path:
try:
quad0 = Image.open(q0path).resize((192,192), Image.ANTIALIAS)
@@ -613,7 +617,7 @@ def render_worldtile(chunks, colstart, colend, rowstart, rowend, path, imgformat
xpos = -192 + (col-colstart)*192
ypos = -96 + (row-rowstart)*96
tileimg.paste(chunkimg.convert("RGB"), (xpos, ypos), chunkimg)
composite.alpha_over(tileimg, chunkimg.convert("RGB"), (xpos, ypos), chunkimg)
# Save them
tileimg.save(imgpath)