summaryrefslogtreecommitdiff
path: root/src/app/sharp96-bad-apple/frames-to-cc
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-02-10 21:46:45 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-02-10 21:46:45 +0100
commitcdf3c02cb8b7a557e8aeeda5b7e13b3139a41b0e (patch)
tree19f8666708075c2a9c40f054b1c13cadcca8d20f /src/app/sharp96-bad-apple/frames-to-cc
parentef9d29ee0ecef0da260388300f354de48b1032c1 (diff)
rename sharp96-bad-apple to bad-apple-msp430fr-sharp96
Diffstat (limited to 'src/app/sharp96-bad-apple/frames-to-cc')
-rwxr-xr-xsrc/app/sharp96-bad-apple/frames-to-cc40
1 files changed, 0 insertions, 40 deletions
diff --git a/src/app/sharp96-bad-apple/frames-to-cc b/src/app/sharp96-bad-apple/frames-to-cc
deleted file mode 100755
index fa12c6f..0000000
--- a/src/app/sharp96-bad-apple/frames-to-cc
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python3
-
-from PIL import Image
-import sys
-import zlib
-
-
-def load_image(filename):
- im = Image.open(filename)
- w, h = im.size
- buf = [0 for i in range(w * h // 8)]
- for y in range(h):
- for x in range(w):
- if im.getpixel((x, y)):
- buf[y * 12 + x // 8] |= 1 << (7 - (x % 8))
- return buf
-
-
-for i in range(1, len(sys.argv) - 2, 3):
- buf = (
- load_image(sys.argv[i])
- + load_image(sys.argv[i + 1])
- + load_image(sys.argv[i + 2])
- )
- c_buf = ",".join(map(str, buf))
- z_buf = zlib.compress(bytes(buf), 9)
- z_buf = z_buf[2:-4]
- out_buf = ",".join(map(str, z_buf))
- print(
- f'__attribute__((section(".text"))) unsigned char const frame{i:04d}[] = {{ {out_buf} }};'
- )
-
-frames = list()
-for i in range(1, len(sys.argv) - 2, 3):
- frames.append(f"(unsigned char*)frame{i:04d}")
-
-prefix = "unsigned char* const frames[] = {"
-postfix = "};"
-
-print(prefix + ", ".join(frames) + postfix)