From 286047699ea041f0c79d9d65aa5f3bd252698ff0 Mon Sep 17 00:00:00 2001 From: Patrick Morgan Date: Sun, 15 Dec 2024 21:41:07 -0800 Subject: [PATCH] WIP --- nodes/nodes.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nodes/nodes.py b/nodes/nodes.py index 89fac40..7e25e2b 100644 --- a/nodes/nodes.py +++ b/nodes/nodes.py @@ -334,19 +334,24 @@ class MaskContourProcessor: canvas = Image.new('F', (width, height), 0.0) draw = ImageDraw.Draw(canvas) - # Render path segments + # Render path segments using Bezier curves for segment in effect_data['path']['segments']: start = segment['startPoint'] end = segment['endPoint'] + control = { + 'x': (start['x'] + end['x']) / 2, + 'y': (start['y'] + end['y']) / 2 + } line_width = segment['properties']['width'] - print(f"Rendering segment from {start} to {end} with width {line_width}") + print(f"Rendering Bezier curve from {start} to {end} with control {control} and width {line_width}") - # Draw line using Pillow + # Draw Bezier curve using Pillow draw.line( - [(start['x'], start['y']), (end['x'], end['y'])], + [(start['x'], start['y']), (control['x'], control['y']), (end['x'], end['y'])], fill=self.stroke_color, - width=int(line_width) + width=int(line_width), + joint='curve' ) # Render decorative elements