Encoder fixes

This commit is contained in:
Casey 2023-10-15 03:29:21 +03:00
parent 90e1709131
commit 3caefb1c41
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
2 changed files with 2 additions and 2 deletions

View File

@ -76,12 +76,12 @@ class Converter:
def export_binary(self, io: BinaryIO):
io.write(b"CCPI")
io.write(bytes([self._img.width // 2, self._img.height // 3, 0]))
io.write(bytes(self._palette))
io.write(bytes(self._palette[: 16 * 3]))
for y in range(0, self._img.height - 2, 3):
for x in range(0, self._img.width - 1, 2):
ch, bg, fg = self._get_block(x, y)
io.write(bytes([
ch & 0xFF,
(ch + 0x80) & 0xFF,
fg << 4 | bg
]))

BIN
rat.cpi

Binary file not shown.