Alpha for rgbXXX modes
This commit is contained in:
parent
9f525df0ff
commit
13c628e00f
10
async-bot.py
10
async-bot.py
|
@ -116,7 +116,9 @@ async def amain():
|
||||||
with Image.open(elem["path"]).convert("RGB") as im:
|
with Image.open(elem["path"]).convert("RGB") as im:
|
||||||
for y in range(im.height):
|
for y in range(im.height):
|
||||||
for x in range(im.width):
|
for x in range(im.width):
|
||||||
r, g, b = im.getpixel((x, y)) # type: ignore
|
r, g, b, a = im.getpixel((x, y)) # type: ignore
|
||||||
|
if a < 128:
|
||||||
|
continue
|
||||||
pocket_x = x + ox
|
pocket_x = x + ox
|
||||||
pocket_y = y + oy
|
pocket_y = y + oy
|
||||||
|
|
||||||
|
@ -126,10 +128,12 @@ async def amain():
|
||||||
mgr.difference[ndx_start + 2] = b > 128
|
mgr.difference[ndx_start + 2] = b > 128
|
||||||
elif elem["type"] == "rgb565":
|
elif elem["type"] == "rgb565":
|
||||||
ox, oy = elem["x"], elem["y"]
|
ox, oy = elem["x"], elem["y"]
|
||||||
with Image.open(elem["path"]).convert("RGB") as im:
|
with Image.open(elem["path"]).convert("RGBA") as im:
|
||||||
for y in range(im.height):
|
for y in range(im.height):
|
||||||
for x in range(im.width):
|
for x in range(im.width):
|
||||||
r, g, b = im.getpixel((x, y)) # type: ignore
|
r, g, b, a = im.getpixel((x, y)) # type: ignore
|
||||||
|
if a < 128:
|
||||||
|
continue
|
||||||
ndx_start: int = (x + ox + (y + oy) * 250) * 16
|
ndx_start: int = (x + ox + (y + oy) * 250) * 16
|
||||||
color = (r >> 3) << 13
|
color = (r >> 3) << 13
|
||||||
color |= (g >> 2) << 5
|
color |= (g >> 2) << 5
|
||||||
|
|
Loading…
Reference in New Issue