mirror of
https://github.com/grp/Wii.py.git
synced 2025-06-18 23:05:48 -04:00
cleaned up code
This commit is contained in:
parent
75b850a436
commit
d1829a5200
22
TPL.py
22
TPL.py
@ -369,15 +369,15 @@ class TPL():
|
||||
z += 1
|
||||
if(z == 16):
|
||||
for i in range(16):
|
||||
out[iv] = lr[i] & 0xff
|
||||
iv += 1
|
||||
out[iv] = la[i] & 0xff
|
||||
iv += 1
|
||||
for i in range(16):
|
||||
out[iv] = lb[i] & 0xff
|
||||
out[iv] = lr[i] & 0xff
|
||||
iv += 1
|
||||
for i in range(16):
|
||||
out[iv] = lg[i] & 0xff
|
||||
iv += 1
|
||||
out[iv] = lb[i] & 0xff
|
||||
iv += 1
|
||||
z = 0
|
||||
return out
|
||||
def toImage(self, outfile):
|
||||
@ -554,11 +554,11 @@ class TPL():
|
||||
def RGB5A3(self, (w, h), jar):
|
||||
out = [0 for i in range(w * h)]
|
||||
i = 0
|
||||
for y1 in range(0, h, 4):
|
||||
for x1 in range(0, w, 4):
|
||||
for y in range(y1, y1 + 4):
|
||||
for x in range(x1, x1 + 4):
|
||||
if(y >= h or x >= w):
|
||||
for y in range(0, h, 4):
|
||||
for x in range(0, w, 4):
|
||||
for y1 in range(y, y + 4):
|
||||
for x1 in range(x, x + 4):
|
||||
if(y1 >= h or x1 >= w):
|
||||
continue
|
||||
pixel = Struct.uint16(jar[i * 2:i * 2 + 2], endian='>')
|
||||
i += 1
|
||||
@ -575,7 +575,7 @@ class TPL():
|
||||
a = (((pixel >> 0) & 0x07) * 64) / 7
|
||||
|
||||
rgba = (r << 0) | (g << 8) | (b << 16) | (a << 24)
|
||||
out[y*w+x] = rgba
|
||||
out[(y1 * w) + x1] = rgba
|
||||
return ''.join(Struct.uint32(p) for p in out)
|
||||
def RGB565(self, (w, h), jar):
|
||||
out = [0 for i in range(w * h)]
|
||||
@ -762,7 +762,7 @@ class TPL():
|
||||
|
||||
c[0] = Struct.uint16(data[off + 0:off + 2], endian='>')
|
||||
c[1] = Struct.uint16(data[off + 2:off + 4], endian='>')
|
||||
if c[0] > c[1]:
|
||||
if(c[0] > c[1]):
|
||||
c[2] = avg(2, 1, c[0], c[1])
|
||||
c[3] = avg(1, 2, c[0], c[1])
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user