mirror of
https://github.com/pmret/papermario.git
synced 2024-11-08 12:02:30 +01:00
fix image building to work with new n64img output (#1001)
This commit is contained in:
parent
accdc4a7f6
commit
0c741974a6
@ -18,16 +18,12 @@ def unpack_color(s):
|
|||||||
return r, g, b, a
|
return r, g, b, a
|
||||||
|
|
||||||
def pack_color(r, g, b, a):
|
def pack_color(r, g, b, a):
|
||||||
r = floor(31 * (r / 255))
|
r = r >> 3
|
||||||
g = floor(31 * (g / 255))
|
g = g >> 3
|
||||||
b = floor(31 * (b / 255))
|
b = b >> 3
|
||||||
|
a = a >> 7
|
||||||
|
|
||||||
s = round(a / 0xFF)
|
return (r << 11) | (g << 6) | (b << 1) | a
|
||||||
s |= (r & 0x1F) << 11
|
|
||||||
s |= (g & 0x1F) << 6
|
|
||||||
s |= (b & 0x1F) << 1
|
|
||||||
|
|
||||||
return s
|
|
||||||
|
|
||||||
def rgb_to_intensity(r, g, b):
|
def rgb_to_intensity(r, g, b):
|
||||||
return round(r * 0.2126 + g * 0.7152 + 0.0722 * b)
|
return round(r * 0.2126 + g * 0.7152 + 0.0722 * b)
|
||||||
@ -110,8 +106,8 @@ class Converter():
|
|||||||
i2 = rgb_to_intensity(*c2[:3])
|
i2 = rgb_to_intensity(*c2[:3])
|
||||||
a2 = c2[3]
|
a2 = c2[3]
|
||||||
|
|
||||||
i1 = floor(7 * (i1 / 0xFF))
|
i1 = i1 >> 5
|
||||||
i2 = floor(7 * (i2 / 0xFF))
|
i2 = i2 >> 5
|
||||||
|
|
||||||
if a1 not in (0, 0xFF) or a2 not in (0, 0xFF):
|
if a1 not in (0, 0xFF) or a2 not in (0, 0xFF):
|
||||||
self.warn("alpha mask mode but translucent pixels used")
|
self.warn("alpha mask mode but translucent pixels used")
|
||||||
|
Loading…
Reference in New Issue
Block a user