diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-03-29 10:25:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-29 10:25:02 +0100 |
| commit | 2439adafa8592995d9acead47ef2802d5d95c373 (patch) | |
| tree | bfa10aaf017bc48cf6c166c7adeb9afd5dc12922 /lib/tartan/fill_element.py | |
| parent | fb1ecd0badf5eb142f17cc7f0f7e8b347151b002 (diff) | |
Add "the tartan universe" (#2782)
Diffstat (limited to 'lib/tartan/fill_element.py')
| -rw-r--r-- | lib/tartan/fill_element.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/tartan/fill_element.py b/lib/tartan/fill_element.py new file mode 100644 index 00000000..34139e6c --- /dev/null +++ b/lib/tartan/fill_element.py @@ -0,0 +1,24 @@ +# 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 inkex import BaseElement + + +def prepare_tartan_fill_element(element: BaseElement) -> None: + """Prepares an svg element to be rendered as a tartan_fill embroidery element + + :param element: svg element with a fill color (path, rectangle, or circle) + """ + parent_group = element.getparent() + if parent_group.get_id().startswith('inkstitch-tartan'): + # apply tartan group transform to element + transform = element.transform @ parent_group.transform + element.set('transform', transform) + # remove tartan group and place element in parent group + outer_group = parent_group.getparent() + outer_group.insert(outer_group.index(parent_group), element) + outer_group.remove(parent_group) + # make sure the element is invisible + element.style['display'] = 'inline' |
