fix areaDownload.py not working on protected pixels

This commit is contained in:
HF 2020-11-30 00:38:28 +01:00
parent 3614c24aa4
commit 56c36b61e6

View File

@ -130,12 +130,13 @@ async def fetch(session, ix, iy, target_matrix):
for b in data: for b in data:
tx = off_x + i % 256 tx = off_x + i % 256
ty = off_y + i // 256 ty = off_y + i // 256
if b == 0: bcl = b & 0x7F
if bcl == 0:
c = 23 c = 23
elif b == 1: elif bcl == 1:
c = 0 c = 0
else: else:
c = b - 2; c = bcl - 2;
target_matrix.set_pixel(tx, ty, EnumColorPixelplanet.index(c)) target_matrix.set_pixel(tx, ty, EnumColorPixelplanet.index(c))
i += 1 i += 1
print("Loaded %s with %s pixels" % (url, i)) print("Loaded %s with %s pixels" % (url, i))
@ -175,8 +176,8 @@ if __name__ == "__main__":
filename = sys.argv[3] filename = sys.argv[3]
x = int(start[0]) x = int(start[0])
y = int(start[1]) y = int(start[1])
w = int(end[0]) - x w = int(end[0]) - x + 1
h =int( end[1]) - y h =int( end[1]) - y + 1
loop = asyncio.get_event_loop() loop = asyncio.get_event_loop()
matrix = loop.run_until_complete(get_area(x, y, w, h)) matrix = loop.run_until_complete(get_area(x, y, w, h))
matrix.create_image(filename) matrix.create_image(filename)