From aa959b1e71849982d67db0c2fe34802c422b1924 Mon Sep 17 00:00:00 2001 From: hkc Date: Fri, 5 Jul 2024 12:02:12 +0300 Subject: [PATCH] Fixed rgb565 mode --- async-bot.py | 23 ++++++++++++++--------- pictures/niko.png | Bin 0 -> 14374 bytes settings.json | 15 ++++----------- 3 files changed, 18 insertions(+), 20 deletions(-) create mode 100644 pictures/niko.png diff --git a/async-bot.py b/async-bot.py index ac730b5..497f7b8 100644 --- a/async-bot.py +++ b/async-bot.py @@ -226,10 +226,10 @@ async def amain() -> None: if a < 128: continue - ndx_start = (x + ox + (y + oy) * 577) * 3 - mgr.put_index(ndx_start, r > 128) - mgr.put_index(ndx_start + 1, g > 128) - mgr.put_index(ndx_start + 2, b > 128) + start_ndx = (x + ox + (y + oy) * 577) * 3 + mgr.put_index(start_ndx, r > 128) + mgr.put_index(start_ndx + 1, g > 128) + mgr.put_index(start_ndx + 2, b > 128) elif elem["type"] == "rgb565": ox, oy = elem["x"], elem["y"] with Image.open(elem["path"]).convert("RGBA") as im: @@ -238,14 +238,19 @@ async def amain() -> None: r, g, b, a = im.getpixel((x, y)) # type: ignore if a < 128: continue - ndx_start = (x + ox + (y + oy) * 250) * 16 - color: int = (r >> 3) << 13 - color |= (g >> 2) << 5 - color |= b >> 3 + + offset: int = (x + ox + (y + oy) * 250) * 16 + + rgb: int = (r >> 3) << 11 + rgb |= (g >> 2) << 5 + rgb |= (b >> 3) + + color: int = (rgb & 0xFF) << 8 + color |= (rgb >> 8) for i in range(16): mgr.put_index( - ndx_start + i, ((color >> i) & 1) > 0 + offset + i, ((color << i) & 0x8000) > 0 ) elif elem["type"] == "rect": for y in range(elem["y"], elem["y"] + elem["h"]): diff --git a/pictures/niko.png b/pictures/niko.png new file mode 100644 index 0000000000000000000000000000000000000000..5661e6f784b31a7c254b92940f27a55e94228260 GIT binary patch literal 14374 zcmeHtcU)6V(`aZ?L`0=a3B4J53suAb0qMO9p?4BGB1#7-(gkVKYmg2iprC*tML|G7 zkX{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