summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2020-05-03 13:08:49 +0200
committerDiego Roversi <diegor@tiscali.it>2020-05-03 13:08:49 +0200
commite7c8fa54260df54af9e3c6599d3255a2dcde5c8f (patch)
tree26dda1c978d27dc789a1cc15bbf08685c1326f9a
parent7dcf600ce94cad5ee03dc50d6f9b385dca67c081 (diff)
pixmap.y: convert string to bytearray
-rw-r--r--common/pixmap.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/pixmap.py b/common/pixmap.py
index 3e52486..fcf9312 100644
--- a/common/pixmap.py
+++ b/common/pixmap.py
@@ -1,5 +1,5 @@
-import io
+import io, sys
def decodepixmap(data):
f = io.BytesIO(data)
@@ -70,9 +70,10 @@ def makebkgnd(w, h, data):
for position in range(0, scanline*h, scanline):
line = []
for p in range(position, position+scanline, 3):
- line.append(2 * (chr(ord(data[p ]) >> 3) +
- chr(ord(data[p+1]) >> 3) +
- chr(ord(data[p+2]) >> 3)))
+ print(f"data[p]={data[p+1]} type={type(data[p+1])}", file=sys.stderr)
+ line.append(2 * ( (data[p ] >> 3).to_bytes(1,byteorder='little') +
+ (data[p+1] >> 3).to_bytes(1,byteorder='little') +
+ (data[p+2] >> 3).to_bytes(1,byteorder='little') ))
line = b''.join(line)
result.append(line)
result.append(line)