From b666668d0e6b67e4632e65486cae814ab5abbc39 Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Thu, 12 Jan 2023 13:41:48 -0600 Subject: updating for linkedin --- tests/xy_to_page.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 tests/xy_to_page.py (limited to 'tests/xy_to_page.py') diff --git a/tests/xy_to_page.py b/tests/xy_to_page.py new file mode 100755 index 0000000..dc552d9 --- /dev/null +++ b/tests/xy_to_page.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +# +(int(xy / 16) * 16) + int((((xy - (int(xy / 16) * 16)))) / 8) + ((xy - ((int(xy / 16) * 16) + int(((xy - (int(xy / 16) * 16))) / 8) * 8)) * 2) + +BLEN = 2 +WIDTH = 8 +HEIGHT = 4 + +for xy in range(0, 32): + page_offset = int(xy / (BLEN * WIDTH)) * (BLEN * WIDTH) + collumn_offset = int((xy - page_offset) / WIDTH) + + bit_offset = page_offset + collumn_offset + ((xy - (page_offset + collumn_offset * WIDTH)) * BLEN) + + page_location = bit_offset + print(page_location) + #print("pixel {}: bit {}".format(xy, column_offset)) + -- cgit v1.2.3