many works

This commit is contained in:
Christoph Haas 2026-01-11 16:20:31 +01:00
parent 9bd764579a
commit c937450f92
7 changed files with 151 additions and 36 deletions

24
lib/helpers.py Normal file
View file

@ -0,0 +1,24 @@
def triangle(image_draw, offset_x, offset_y, direction, width, height):
"""Show triangle. Direction is -1 (down) or 1 (up)."""
points = []
color = None
if direction==1:
points = [
(width/2, 0), # n
(0, height), # sw
(width, height) # se
]
color = (0, 255, 0) # green
else:
points = [
(width/2, height), # s
(0, 0), # nw
(width,0) # ne
]
color = (255, 0, 0) # red
# Draw a filled green triangle
points = [(x+offset_x, y+offset_y) for (x,y) in points]
image_draw.polygon(points, fill=color)