Encoder fixes
This commit is contained in:
parent
90e1709131
commit
3caefb1c41
|
@ -76,12 +76,12 @@ class Converter:
|
||||||
def export_binary(self, io: BinaryIO):
|
def export_binary(self, io: BinaryIO):
|
||||||
io.write(b"CCPI")
|
io.write(b"CCPI")
|
||||||
io.write(bytes([self._img.width // 2, self._img.height // 3, 0]))
|
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 y in range(0, self._img.height - 2, 3):
|
||||||
for x in range(0, self._img.width - 1, 2):
|
for x in range(0, self._img.width - 1, 2):
|
||||||
ch, bg, fg = self._get_block(x, y)
|
ch, bg, fg = self._get_block(x, y)
|
||||||
io.write(bytes([
|
io.write(bytes([
|
||||||
ch & 0xFF,
|
(ch + 0x80) & 0xFF,
|
||||||
fg << 4 | bg
|
fg << 4 | bg
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue