diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-05-10 09:02:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-10 09:02:47 +0200 |
| commit | c799b798bc01ac9fc307a1dbc3c1ae68f1224669 (patch) | |
| tree | 791955fd75f8f93f8a1cb66c82cc29d0600aaf86 /lib/svg | |
| parent | 9d5cc6013ef769718b47d64a558df7e4210505d1 (diff) | |
apply clip to stroke (#2283)
Diffstat (limited to 'lib/svg')
| -rw-r--r-- | lib/svg/clip.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/svg/clip.py b/lib/svg/clip.py new file mode 100644 index 00000000..36c73947 --- /dev/null +++ b/lib/svg/clip.py @@ -0,0 +1,18 @@ +# Authors: see git history +# +# Copyright (c) 2023 Authors +# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. + +from shapely.geometry import MultiPolygon, Polygon + +from ..elements import EmbroideryElement + + +def get_clip_path(node): + # get clip and apply node transform + clip = node.clip + transform = node.composed_transform() + clip.transform = transform + clip_element = EmbroideryElement(clip) + clip_element.paths.sort(key=lambda point_list: Polygon(point_list).area, reverse=True) + return MultiPolygon([(clip_element.paths[0], clip_element.paths[1:])]) |
