aboutsummaryrefslogtreecommitdiff
path: root/host/terminal.py
blob: 86b4db1f57e5b41e872e573d5676ba6bf771db8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from pixelterm.pixelterm import termify_pixels

class MockImage:
    def __init__(self, nparray):
        self.nparray = nparray
        self.im = self

    @property
    def size(self):
        h, w, _ = self.nparray.shape
        return (w, h)

    def getpixel(self, pos):
        x, y = pos
        return tuple(self.nparray[y][x])

def printframe(framedata):
    print(termify_pixels(MockImage(framedata)))