summaryrefslogtreecommitdiff
path: root/lib/patterns.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2022-01-12 21:14:00 +0100
committerGitHub <noreply@github.com>2022-01-12 21:14:00 +0100
commit0db5548567aa2bc3bc06461f030716a1382afeeb (patch)
treeb3c30d1e698c56be81b0c56dba33cf59ad914169 /lib/patterns.py
parent140a2458e128bd4f358edf2c38e0839990043eec (diff)
Impove fill pattern (#1540)
* unnonected fill pattern * apply fill patterns first
Diffstat (limited to 'lib/patterns.py')
-rw-r--r--lib/patterns.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/patterns.py b/lib/patterns.py
index 8a0c8449..da22f21b 100644
--- a/lib/patterns.py
+++ b/lib/patterns.py
@@ -20,8 +20,8 @@ def is_pattern(node):
def apply_patterns(patches, node):
patterns = _get_patterns(node)
- _apply_stroke_patterns(patterns['stroke_patterns'], patches)
_apply_fill_patterns(patterns['fill_patterns'], patches)
+ _apply_stroke_patterns(patterns['stroke_patterns'], patches)
def _apply_stroke_patterns(patterns, patches):
@@ -66,7 +66,6 @@ def _apply_fill_patterns(patterns, patches):
def _get_patterns(node):
from .elements import EmbroideryElement
- from .elements.fill import Fill
from .elements.stroke import Stroke
fills = []
@@ -82,8 +81,10 @@ def _get_patterns(node):
stroke = element.get_style('stroke')
if fill is not None:
- fill_pattern = Fill(pattern).shape
- fills.append(fill_pattern)
+ fill_pattern = Stroke(pattern).paths
+ linear_rings = [shgeo.LinearRing(path) for path in fill_pattern]
+ for ring in linear_rings:
+ fills.append(shgeo.Polygon(ring))
if stroke is not None:
stroke_pattern = Stroke(pattern).paths