py3k: Remove tuples in parameter lists

Py3k no longer supports unpacking tuples in the parameters.
This commit is contained in:
Brian Crowell 2012-10-15 21:32:28 -05:00 committed by Brian Crowell
parent 5076c35cc5
commit abd215e457
3 changed files with 11 additions and 6 deletions

View File

@ -22,19 +22,21 @@ HEADERSIZE = 8
def nextheader(fobj):
return struct.unpack('>4sI', fobj.read(HEADERSIZE))
def read_32t(fobj, (start, length), (width, height)):
def read_32t(fobj, start_length, size):
# The 128x128 icon seems to have an extra header for some reason.
(start, length) = start_length
fobj.seek(start)
sig = fobj.read(4)
if sig != '\x00\x00\x00\x00':
raise SyntaxError('Unknown signature, expecting 0x00000000')
return read_32(fobj, (start + 4, length - 4), (width, height))
return read_32(fobj, (start + 4, length - 4), size)
def read_32(fobj, (start, length), size):
def read_32(fobj, start_length, size):
"""
Read a 32bit RGB icon resource. Seems to be either uncompressed or
an RLE packbits-like scheme.
"""
(start, length) = start_length
fobj.seek(start)
sizesq = size[0] * size[1]
if length == sizesq * 3:
@ -73,8 +75,9 @@ def read_32(fobj, (start, length), size):
im.im.putband(band.im, band_ix)
return {"RGB": im}
def read_mk(fobj, (start, length), size):
def read_mk(fobj, start_length, size):
# Alpha masks seem to be uncompressed
(start, length) = start_length
fobj.seek(start)
band = Image.frombuffer(
"L", size, fobj.read(size[0]*size[1]), "raw", "L", 0, 1

View File

@ -1332,7 +1332,8 @@ class Image:
math.cos(angle), math.sin(angle), 0.0,
-math.sin(angle), math.cos(angle), 0.0
]
def transform(x, y, (a, b, c, d, e, f)=matrix):
def transform(x, y, matrix=matrix):
(a, b, c, d, e, f) = matrix
return a*x + b*y + c, d*x + e*y + f
# calculate output size

View File

@ -68,7 +68,8 @@ class Draw:
else:
getattr(self.draw, op)(xy, fill=fill, outline=outline)
def settransform(self, (xoffset, yoffset)):
def settransform(self, offset):
(xoffset, yoffset) = offset
self.transform = (1, 0, xoffset, 0, 1, yoffset)
def arc(self, xy, start, end, *options):