From 287a9ce28410d49169e1e577a68ca4a3def804a6 Mon Sep 17 00:00:00 2001 From: erjemin Date: Sat, 5 Sep 2026 19:04:40 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D1=8F=D0=B4=D1=80=D0=BE=20(07)=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=87=D0=B8=D0=BD=D0=BA=D0=B0=20=D0=BA=D0=BE=D0=BB=D0=B5?= =?UTF-8?q?=D1=87=D0=B5=D0=BA=20=D0=B8=20=D1=81=D0=B5=D1=80=D0=B4=D0=B5?= =?UTF-8?q?=D1=87=D0=B5=D0=BA.=20=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8?= =?UTF-8?q?=D0=B7=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D1=8B=20=D0=BA=D1=80?= =?UTF-8?q?=D0=B5=D1=81=D1=82=D1=8B...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hypn0/hypn0_site/services/halftone.py | 22 +++++++++++++++------- hypn0/hypn0_site/tests.py | 10 ++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/hypn0/hypn0_site/services/halftone.py b/hypn0/hypn0_site/services/halftone.py index 69842b3..cfdc99e 100644 --- a/hypn0/hypn0_site/services/halftone.py +++ b/hypn0/hypn0_site/services/halftone.py @@ -29,9 +29,16 @@ def generate_shape_def(shape: str, radius: int, shape_id: str) -> str: r = radius match shape: case "ring": - stroke_width = max(1.0, r * 0.35) - inner_r = max(0.5, r - stroke_width / 2.0) - return f'' + inner_r = max(1, round(r * 0.55)) + if inner_r >= r: + inner_r = max(0, r - 1) + if inner_r == 0: + return f'' + return ( + f'' + ) case "square": size = r * 2 @@ -63,7 +70,7 @@ def generate_shape_def(shape: str, radius: int, shape_id: str) -> str: case "cross": arm = max(1, round(r * 0.35)) - return f'' + return f'' case "line": th = max(1, round(r * 0.25)) @@ -74,10 +81,11 @@ def generate_shape_def(shape: str, radius: int, shape_id: str) -> str: return f'' case "heart": - scale_f = r / 12.0 + r_top = round(r * 0.3) + r_mid = round(r * 0.4) return ( - f'' + f'' ) case "circle" | _: diff --git a/hypn0/hypn0_site/tests.py b/hypn0/hypn0_site/tests.py index 221c9fb..68fb4e3 100644 --- a/hypn0/hypn0_site/tests.py +++ b/hypn0/hypn0_site/tests.py @@ -85,6 +85,16 @@ class HalftoneServiceTests(BaseMediaTestCase): self.assertIn("", svg) self.assertIn("", svg) + # Проверяем структуру кольца: путь с вырезанным отверстием (evenodd) + ring_svg = generate_halftone_svg(self.img, cols=20, max_radius=8, shape="ring") + self.assertIn('fill-rule="evenodd"', ring_svg) + self.assertIn('