Files
frontend-dev/frontend/views/draw_utils.py
2026-03-12 23:31:58 +01:00

27 lines
1.3 KiB
Python

def draw_clock(draw, position, radius=16, width=1, color='black'):
"""Draw a simple clock icon at the given position"""
x, y = position
draw.circle((x, y), radius, outline=color, width=width)
draw.line((x, y - radius + 2, x, y), fill=color, width=width) # Hour hand
draw.line((x, y, x + radius * 3 / 4, y), fill=color, width=width) # Minute hand
def draw_long_press(draw, position):
"""Draw a long press button icon at the given position"""
x, y = position
for i in range(0, 5, 2):
draw.circle((x + i, y), 2, fill='black')
def draw_bluetooth_icon(draw, position, size=6, color='black'):
"""Draw a minimal Bluetooth icon (stylised B with two pointed flanges)."""
x, y = position
h = size # half-height of the centre line
w = size // 2 # half-width of the diamond cross
# Vertical spine
draw.line([(x, y - h), (x, y + h)], fill=color, width=1)
# Upper arm: spine top -> right tip -> spine midpoint
draw.line([(x, y - h), (x + w, y - h // 2)], fill=color, width=1)
draw.line([(x + w, y - h // 2), (x, y)], fill=color, width=1)
# Lower arm: spine midpoint -> right tip -> spine bottom
draw.line([(x, y), (x + w, y + h // 2)], fill=color, width=1)
draw.line([(x + w, y + h // 2), (x, y + h)], fill=color, width=1)