From e84a86d4ac0caf29d6074728376ff0a594243fec Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Thu, 4 Mar 2021 18:40:53 +0100 Subject: Update for Inkscape 1.0 (#880) * update for inkscape 1.0 * add about extension * Build improvements for the inkscape1.0 branch (#985) * zip: export real svg not stitch plan * #411 and #726 * Tools for Font Creators (#1018) * ignore very small holes in fills * remove embroider (#1026) * auto_fill: ignore shrink_or_grow if result is empty (#589) * break apart: do not ignore small fills Co-authored-by: Hagen Fritsch Co-authored-by: Lex Neva --- lib/elements/svg_objects.py | 71 --------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 lib/elements/svg_objects.py (limited to 'lib/elements/svg_objects.py') diff --git a/lib/elements/svg_objects.py b/lib/elements/svg_objects.py deleted file mode 100644 index 4760af5f..00000000 --- a/lib/elements/svg_objects.py +++ /dev/null @@ -1,71 +0,0 @@ -def rect_to_path(node): - x = float(node.get('x', '0')) - y = float(node.get('y', '0')) - width = float(node.get('width', '0')) - height = float(node.get('height', '0')) - rx = 0 - ry = 0 - - # rounded corners - # the following rules apply for radius calculations: - # * if rx or ry is missing it has to take the value of the other one - # * the radius cannot be bigger than half of the corresponding side - # (otherwise we receive an invalid path) - if node.get('rx') or node.get('ry'): - if node.get('rx'): - rx = float(node.get('rx', '0')) - ry = rx - if node.get('ry'): - ry = float(node.get('ry', '0')) - if not ry: - ry = rx - - rx = min(width/2, rx) - ry = min(height/2, ry) - - path = 'M %(startx)f,%(y)f ' \ - 'h %(width)f ' \ - 'q %(rx)f,0 %(rx)f,%(ry)f ' \ - 'v %(height)f ' \ - 'q 0,%(ry)f -%(rx)f,%(ry)f ' \ - 'h -%(width)f ' \ - 'q -%(rx)f,0 -%(rx)f,-%(ry)f ' \ - 'v -%(height)f ' \ - 'q 0,-%(ry)f %(rx)f,-%(ry)f ' \ - 'Z' \ - % dict(startx=x+rx, x=x, y=y, width=width-(2*rx), height=height-(2*ry), rx=rx, ry=ry) - - else: - path = "M %f,%f H %f V %f H %f Z" % (x, y, width+x, height+y, x) - - return path - - -def ellipse_to_path(node): - rx = float(node.get('rx', "0")) or float(node.get('r', "0")) - ry = float(node.get('ry', "0")) or float(node.get('r', "0")) - cx = float(node.get('cx')) - cy = float(node.get('cy')) - - path = 'M %(cx_r)f,%(cy)f' \ - 'C %(cx_r)f,%(cy_r)f %(cx)f,%(cy_r)f %(cx)f,%(cy_r)f ' \ - '%(cxr)f,%(cy_r)f %(cxr)f,%(cy)f %(cxr)f,%(cy)f ' \ - '%(cxr)f,%(cyr)f %(cx)f,%(cyr)f %(cx)f,%(cyr)f ' \ - '%(cx_r)f,%(cyr)f %(cx_r)f,%(cy)f %(cx_r)f,%(cy)f ' \ - 'Z' \ - % dict(cx=cx, cx_r=cx-rx, cxr=cx+rx, cy=cy, cyr=cy+ry, cy_r=cy-ry) - - return path - - -def circle_to_path(node): - cx = float(node.get('cx')) - cy = float(node.get('cy')) - r = float(node.get('r')) - - path = 'M %(xstart)f, %(cy)f ' \ - 'a %(r)f,%(r)f 0 1,0 %(rr)f,0 ' \ - 'a %(r)f,%(r)f 0 1,0 -%(rr)f,0 ' \ - % dict(xstart=(cx-r), cy=cy, r=r, rr=(r*2)) - - return path -- cgit v1.2.3