Added support for line and rect in the preview of sketches

This commit is contained in:
Anand Chitipothu
2021-03-17 11:40:04 +00:00
parent 49e65c9e43
commit 9c485dbd4e

View File

@@ -41,4 +41,8 @@ def draw_image(commands):
for c in commands:
if c['function'] == 'circle':
img.append(draw.Circle(cx=c['x'], cy=c['y'], r=c['d']/2))
elif c['function'] == 'line':
img.append(draw.Line(x1=c['x1'], y1=c['y1'], x2=c['x2'], y2=c['y2']))
elif c['function'] == 'rect':
img.append(draw.Rectangle(x=c['x'], y=c['y'], width=c['w'], height=c['h']))
return img