From a0baee69f83da1359e9b471c8d01ef12365dc2f3 Mon Sep 17 00:00:00 2001 From: Florin Tobler Date: Thu, 28 Jul 2022 17:03:21 +0200 Subject: [PATCH] add mirroring --- clock_pillow.py | 4 ++++ main.py | 1 + 2 files changed, 5 insertions(+) diff --git a/clock_pillow.py b/clock_pillow.py index 24633c9..f054d66 100644 --- a/clock_pillow.py +++ b/clock_pillow.py @@ -5,6 +5,8 @@ from PIL import Image from PIL import ImageDraw from PIL import ImageFont +mirror = False + def rgb(r=0, g=None, b=None): if g == None: @@ -19,6 +21,8 @@ def rrc(tuple, center, angle): cos = math.cos(angle) tpl = (tuple[0] - center[0], tuple[1] - center[1]) tpl = tuple + if mirror: + cos = -cos return (int(tpl[0] * sin + tpl[1] * cos + center[0]), int(-tpl[0] * cos + tpl[1] * sin + center[1])) diff --git a/main.py b/main.py index 49ba29b..199db1d 100644 --- a/main.py +++ b/main.py @@ -4,6 +4,7 @@ import time def main(): + clock_pillow.mirror = True fb = Framebuffer(device_no=0) while True: img = clock_pillow.draw_clock(pixelformat="RGBA", aliasing=None)