svg-ultralight 0.30.1__tar.gz → 0.31.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of svg-ultralight might be problematic. Click here for more details.
- {svg_ultralight-0.30.1/src/svg_ultralight.egg-info → svg_ultralight-0.31.0}/PKG-INFO +1 -1
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/pyproject.toml +2 -2
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/__init__.py +9 -1
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/transformations.py +14 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0/src/svg_ultralight.egg-info}/PKG-INFO +1 -1
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight.egg-info/SOURCES.txt +1 -0
- svg_ultralight-0.31.0/tests/test_matrices.py +34 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/.gitignore +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/.pre-commit-config.yaml +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/README.md +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/setup.cfg +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/animate.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/__init__.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/bound_helpers.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/supports_bounds.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/type_bound_collection.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/type_bound_element.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/type_bounding_box.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/type_padded_text.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/constructors/__init__.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/constructors/new_element.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/inkscape.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/layout.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/main.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/metadata.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/nsmap.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/py.typed +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/query.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/root_elements.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/string_conversion.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/strings/__init__.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/strings/svg_strings.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/unit_conversion.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight.egg-info/dependency_links.txt +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight.egg-info/requires.txt +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight.egg-info/top_level.txt +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/__init__.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/conftest.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_bounding.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_inkscape.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_layout.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_metadata.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_new_element.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_queries.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_root_elements.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_string_conversion.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tests/test_svg_ultralight.py +0 -0
- {svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/tox.ini +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "svg-ultralight"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.31.0"
|
|
4
4
|
description = "a sensible way to create svg files with Python"
|
|
5
5
|
authors = [{ name = "Shay Hill", email = "shay_public@hotmail.com" }]
|
|
6
6
|
license = { text = "MIT" }
|
|
@@ -37,7 +37,7 @@ legacy_tox_ini = """
|
|
|
37
37
|
|
|
38
38
|
[tool.commitizen]
|
|
39
39
|
name = "cz_conventional_commits"
|
|
40
|
-
version = "0.
|
|
40
|
+
version = "0.31.0"
|
|
41
41
|
tag_format = "$version"
|
|
42
42
|
version_files = ["pyproject.toml:^version"]
|
|
43
43
|
annotated_tag = true
|
|
@@ -38,7 +38,12 @@ from svg_ultralight.string_conversion import (
|
|
|
38
38
|
format_numbers,
|
|
39
39
|
format_numbers_in_string,
|
|
40
40
|
)
|
|
41
|
-
from svg_ultralight.transformations import
|
|
41
|
+
from svg_ultralight.transformations import (
|
|
42
|
+
mat_apply,
|
|
43
|
+
mat_dot,
|
|
44
|
+
mat_invert,
|
|
45
|
+
transform_element,
|
|
46
|
+
)
|
|
42
47
|
|
|
43
48
|
__all__ = [
|
|
44
49
|
"BoundCollection",
|
|
@@ -52,6 +57,9 @@ __all__ = [
|
|
|
52
57
|
"format_number",
|
|
53
58
|
"format_numbers",
|
|
54
59
|
"format_numbers_in_string",
|
|
60
|
+
"mat_apply",
|
|
61
|
+
"mat_dot",
|
|
62
|
+
"mat_invert",
|
|
55
63
|
"new_bbox_union",
|
|
56
64
|
"new_bound_union",
|
|
57
65
|
"new_element",
|
|
@@ -59,6 +59,20 @@ def mat_apply(mat1: _Matrix, mat2: tuple[float, float]) -> tuple[float, float]:
|
|
|
59
59
|
return mat1[0] * mat2[0] + mat1[4], mat1[3] * mat2[1] + mat1[5]
|
|
60
60
|
|
|
61
61
|
|
|
62
|
+
def mat_invert(tmat: _Matrix) -> _Matrix:
|
|
63
|
+
"""Invert a 2D transformation matrix in svg format."""
|
|
64
|
+
a, b, c, d, e, f = tmat
|
|
65
|
+
det = a * d - b * c
|
|
66
|
+
return (
|
|
67
|
+
d / det,
|
|
68
|
+
-b / det,
|
|
69
|
+
-c / det,
|
|
70
|
+
a / det,
|
|
71
|
+
(c * f - d * e) / det,
|
|
72
|
+
(b * e - a * f) / det,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
62
76
|
def get_transform_matrix(elem: EtreeElement) -> _Matrix:
|
|
63
77
|
"""Get the transformation matrix from an svg element.
|
|
64
78
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""Test transformations of matrices.
|
|
2
|
+
|
|
3
|
+
:author: Shay Hill
|
|
4
|
+
:created: 2024-05-05
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from svg_ultralight.transformations import mat_dot, mat_apply, mat_invert
|
|
8
|
+
import random
|
|
9
|
+
import math
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class TestMat:
|
|
13
|
+
def test_explicit(self):
|
|
14
|
+
expect = (31, 46, 12, 22, 10, 14)
|
|
15
|
+
assert mat_dot((1, 2, 3, 4, 5, 6), (7, 8, 9, 1, 2, 1)) == expect
|
|
16
|
+
|
|
17
|
+
def test_apply(self):
|
|
18
|
+
expect = (12, 38)
|
|
19
|
+
assert mat_apply((1, 2, 3, 4, 5, 6), (7, 8)) == expect
|
|
20
|
+
|
|
21
|
+
def test_invert(self):
|
|
22
|
+
identity = (1, 0, 0, 1, 0, 0)
|
|
23
|
+
for _ in range(10):
|
|
24
|
+
tmat = (
|
|
25
|
+
random.randint(-10, 10),
|
|
26
|
+
random.randint(-10, 10),
|
|
27
|
+
random.randint(-10, 10),
|
|
28
|
+
random.randint(-10, 10),
|
|
29
|
+
random.randint(-10, 10),
|
|
30
|
+
random.randint(-10, 10),
|
|
31
|
+
)
|
|
32
|
+
result = mat_dot(tmat, mat_invert(tmat))
|
|
33
|
+
for x, y in zip(result, identity):
|
|
34
|
+
assert math.isclose(x, y, abs_tol=0.0001)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/__init__.py
RENAMED
|
File without changes
|
{svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/bound_helpers.py
RENAMED
|
File without changes
|
{svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/bounding_boxes/supports_bounds.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight/constructors/new_element.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{svg_ultralight-0.30.1 → svg_ultralight-0.31.0}/src/svg_ultralight.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|