Commit 1d27a0e2 authored by Jens Kober's avatar Jens Kober Committed by Martin Owens

fixed perspective to take transformation into acocunt #226, fixed perspective...

fixed perspective to take transformation into acocunt #226, fixed perspective and envelope to work again on groups #218 and #155, fixed order of transformations in composed_transform (similar to merge 176)
parent 4af033bd
......@@ -457,7 +457,7 @@ class ShapeElement(BaseElement):
if none specified the transform is to the root document element"""
parent = self.getparent()
if parent is not None and isinstance(parent, ShapeElement):
return self.transform * parent.composed_transform()
return parent.composed_transform() * self.transform
return self.transform
def composed_style(self):
......
......@@ -22,35 +22,59 @@ from inkex.transforms import DirectedLineSegment
from inkex.localization import inkex_gettext as _
class Envelope(inkex.EffectExtension):
"""Distort a path to a second path"""
"""Distort a path/group of paths to a second path"""
def effect(self):
paths = list(self.svg.selection.filter(inkex.PathElement))
if len(paths) != 2:
raise inkex.AbortExtension(_("You must select two paths only."))
if len(self.svg.selection) != 2:
raise inkex.AbortExtension(_("You must select two objects only."))
obj, envelope = paths
obj, envelope = self.svg.selection
# Get bounding box plus any extra composed transform.
bbox = obj.bounding_box(transform=True)
if isinstance(obj, (inkex.PathElement, inkex.Group)):
if isinstance(envelope, inkex.PathElement):
# Get bounding box plus any extra composed transform of parents.
bbox = obj.bounding_box(obj.getparent().composed_transform())
# distil trafo into four node points
path = envelope.path.transform(envelope.composed_transform()).to_superpath()
if len(path[0]) < 4:
raise inkex.AbortExtension(_("Selected path is too short. Must be four or more nodes."))
# distill trafo into four node points
path = envelope.path.transform(envelope.composed_transform()).to_superpath()
if len(path[0]) < 4:
raise inkex.AbortExtension(_("Selected path is too short. Must be four or more nodes."))
trafo = [[(csp[1][0], csp[1][1]) for csp in subs] for subs in path][0][:4]
trafo = [[(csp[1][0], csp[1][1]) for csp in subs] for subs in path][0][:4]
#vectors pointing away from the trafo origin
tbox = [
DirectedLineSegment(trafo[0], trafo[1]),
DirectedLineSegment(trafo[1], trafo[2]),
DirectedLineSegment(trafo[3], trafo[2]),
DirectedLineSegment(trafo[0], trafo[3]),
]
#vectors pointing away from the trafo origin
tbox = [
DirectedLineSegment(trafo[0], trafo[1]),
DirectedLineSegment(trafo[1], trafo[2]),
DirectedLineSegment(trafo[3], trafo[2]),
DirectedLineSegment(trafo[0], trafo[3]),
]
else:
if isinstance(envelope, inkex.Group):
raise inkex.AbortExtension(_("The second selected object is a group, not a"
" path.\nTry using Object->Ungroup."))
raise inkex.AbortExtension(_("The second selected object is not a path.\nTry using"
" the procedure Path->Object to Path."))
else:
raise inkex.AbortExtension(_("The first selected object is neither a path nor a group.\nTry using"
" the procedure Path->Object to Path."))
self.process_object(obj, tbox, bbox)
def process_object(self, obj, tbox, bbox):
if isinstance(obj, inkex.PathElement):
self.process_path(obj, tbox, bbox)
elif isinstance(obj, inkex.Group):
self.process_group(obj, tbox, bbox)
def process_group(self, group, tbox, bbox):
"""Go through all groups to process all paths inside them"""
for node in group:
self.process_object(node, tbox, bbox)
def process_path(self, element, tbox, bbox):
# Get out path's absolute and root coordinates, so obj and envelope
# are always in the same coordinate system.
points = obj.path.to_absolute().transform(obj.composed_transform()).to_superpath()
points = element.path.to_absolute().transform(element.composed_transform()).to_superpath()
for subs in points:
for csp in subs:
......@@ -59,7 +83,7 @@ class Envelope(inkex.EffectExtension):
csp[2] = self.transform_point(tbox, bbox, *csp[2])
# Put the modified path back, undo the root transformation
obj.path = points.to_path().transform(-obj.composed_transform())
element.path = points.to_path().transform(-element.composed_transform())
@staticmethod
def transform_point(tbox, bbox, x, y):
......
......@@ -21,7 +21,6 @@ Perspective approach & math by Dmitry Platonov, [email protected], 2006
"""
import inkex
from inkex import SvgDocumentElement
from inkex.localization import inkex_gettext as _
X, Y = range(2)
......@@ -35,7 +34,7 @@ except ImportError:
class Perspective(inkex.EffectExtension):
"""Apply a perspective to a path"""
"""Apply a perspective to a path/group of paths"""
def effect(self):
if np is None:
raise inkex.AbortExtension(
......@@ -43,15 +42,13 @@ class Perspective(inkex.EffectExtension):
" These modules are required by this extension. Please install them."
" On a Debian-like system this can be done with the command, "
"sudo apt-get install python-numpy."))
if len(self.options.ids) < 2:
raise inkex.AbortExtension(_("This extension requires two selected paths."))
if len(self.svg.selection) != 2:
raise inkex.AbortExtension(_("This extension requires two selected objects."))
obj = self.svg.selected[self.options.ids[0]]
envelope = self.svg.selected[self.options.ids[1]]
obj, envelope = self.svg.selection
if isinstance(obj, (inkex.PathElement, inkex.Group)):
if isinstance(envelope, inkex.PathElement):
obj.path = obj.path.to_absolute()
path = envelope.path.transform(envelope.composed_transform()).to_superpath()
if len(path) < 1 or len(path[0]) < 4:
......@@ -63,8 +60,8 @@ class Perspective(inkex.EffectExtension):
dip[i][0] = path[0][i][1][0]
dip[i][1] = path[0][i][1][1]
# query inkscape about the bounding box of obj
bbox = obj.bounding_box()
# Get bounding box plus any extra composed transform of parents.
bbox = obj.bounding_box(obj.getparent().composed_transform())
sip = np.array([
[bbox.left, bbox.bottom],
......@@ -78,7 +75,7 @@ class Perspective(inkex.EffectExtension):
raise inkex.AbortExtension(_("The second selected object is not a path.\nTry using"
" the procedure Path->Object to Path."))
else:
raise inkex.AbortExtension(_("The first selected object is not a path.\nTry using"
raise inkex.AbortExtension(_("The first selected object is neither a path nor a group.\nTry using"
" the procedure Path->Object to Path."))
solmatrix = np.zeros((8, 8), dtype=FLOAT)
......@@ -102,22 +99,23 @@ class Perspective(inkex.EffectExtension):
[res[0], res[1], res[2]],
[res[3], res[4], res[5]],
[res[6], res[7], 1.0]], dtype=FLOAT)
self.process_object(obj, projmatrix)
def process_object(self, obj, matrix):
if isinstance(obj, inkex.PathElement):
self.process_path(obj, projmatrix)
if isinstance(obj, inkex.Group):
self.process_group(obj, projmatrix)
self.process_path(obj, matrix)
elif isinstance(obj, inkex.Group):
self.process_group(obj, matrix)
def process_group(self, group, matrix):
"""Go through all groups to process all paths inside them"""
for node in group:
if isinstance(node, inkex.PathElement):
self.process_path(node, matrix)
if isinstance(node, SvgDocumentElement):
self.process_group(node, matrix)
self.process_object(node, matrix)
def process_path(self, element, matrix):
"""Apply the transformation to the selected path"""
point = element.path.to_superpath()
point = element.path.to_absolute().transform(element.composed_transform()).to_superpath()
for subs in point:
for csp in subs:
csp[0] = self.project_point(csp[0], matrix)
......
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg1442" version="1.1" viewBox="0 0 48.229092 27.352564" height="27.352564mm" width="48.229092mm">
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1" transform="translate(-84.77, -2.14013)">
<path style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 112.2612,24.293057 -13.426401,2.78804 -13.88065,-10.77967 11.05107,-1.80082 z" id="envelope" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
<g id="obj" transform="matrix(1.18319 0 0 1.24513 -21.0142 -3.87601)" style="stroke-width:0.823883">
<path d="M 112.64 22.6234 L 101.293 24.8626 L 89.5614 16.2051 L 98.9014 14.7588 Z" style="fill:#ff0000;stroke-width:0.823883;stop-color:#000000" id="rectangle"/>
<g transform="translate(-0.15119, -0.147829)" id="ellipse" style="stroke-width:0.823883">
<path id="path868" style="fill:#ffff00;stroke-width:0.823883;stop-color:#000000" d="M 88.9332 14.6227 C 88.4768 14.286 88.2048 13.9367 88.1743 13.653 C 88.1403 13.3705 88.3504 13.1767 88.7612 13.1132 C 89.6164 12.9807 91.1238 13.4246 92.128 14.1046 C 93.1322 14.7845 93.2092 15.4604 92.3 15.6141 C 91.8634 15.6879 91.2609 15.6259 90.6278 15.4407 C 89.9981 15.2541 89.3895 14.9595 88.9332 14.6227" transform="translate(2.5, 3)"/>
<g style="stroke-width:0.90823" transform="matrix(0.772837 0 -0.78133 1.06475 36.8685 -0.744527)" id="g877">
<path sodipodi:nodetypes="cc" id="line" d="M 108.024 23.3548 L 95.6477 15.3974" style="fill:none;stroke:#000000;stroke-width:0.961211;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
</g>
</g>
<g style="font-style:normal;font-weight:normal;font-size:2.90648px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:0.179595" id="text" transform="scale(1.02584, 0.974809)" aria-label="Test">
<path id="path1097" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 107.067 22.7975 L 104.594 23.3027 L 104.278 23.0942 L 105.311 22.8841 L 102.817 21.2762 L 103.198 21.2014 L 105.707 22.8036 L 106.74 22.5935 Z"/>
<path id="path1099" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 101.42 22.5186 L 101.256 22.4067 L 102.87 22.086 C 102.619 21.9337 102.367 21.8295 102.115 21.773 C 101.863 21.7175 101.622 21.7123 101.391 21.7575 C 101.258 21.7837 101.145 21.8197 101.052 21.8657 C 100.958 21.9119 100.88 21.9687 100.82 22.0362 L 100.503 21.8199 C 100.577 21.7608 100.665 21.7094 100.769 21.6657 C 100.872 21.622 100.991 21.5871 101.125 21.5609 C 101.461 21.4953 101.824 21.507 102.214 21.5958 C 102.605 21.6844 102.966 21.8369 103.298 22.0535 C 103.641 22.2775 103.818 22.4741 103.827 22.6437 C 103.836 22.8149 103.677 22.9336 103.351 22.9996 C 103.059 23.0587 102.739 23.0451 102.392 22.9585 C 102.046 22.8727 101.722 22.7259 101.42 22.5186 Z M 101.87 22.5155 C 102.057 22.6398 102.258 22.7284 102.474 22.7814 C 102.689 22.8344 102.885 22.8432 103.06 22.8079 C 103.258 22.768 103.364 22.7003 103.376 22.6049 C 103.386 22.51 103.303 22.3963 103.125 22.2636 Z"/>
<path id="path1101" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 100.325 23.5145 L 100.018 23.2943 C 100.166 23.3078 100.305 23.3121 100.437 23.3072 C 100.569 23.3022 100.693 23.2881 100.809 23.2647 C 100.985 23.2292 101.093 23.1849 101.132 23.1319 C 101.169 23.0792 101.137 23.0178 101.037 22.9476 C 100.96 22.8942 100.868 22.8583 100.761 22.8399 C 100.656 22.8223 100.489 22.8186 100.26 22.8287 L 100.115 22.8351 C 99.8149 22.8496 99.5676 22.8348 99.3725 22.7907 C 99.1776 22.7475 98.9998 22.668 98.839 22.5523 C 98.6558 22.4205 98.5888 22.3009 98.6376 22.1936 C 98.6846 22.0867 98.8433 22.0069 99.1139 21.954 C 99.2267 21.9319 99.3552 21.9164 99.4996 21.9075 C 99.6415 21.8979 99.8013 21.8944 99.9789 21.897 L 100.322 22.1342 C 100.13 22.1154 99.9549 22.107 99.7979 22.109 C 99.6422 22.1117 99.5033 22.1251 99.3813 22.149 C 99.2177 22.1812 99.1179 22.2244 99.0819 22.2787 C 99.0469 22.3339 99.0771 22.3956 99.1728 22.4638 C 99.2613 22.5269 99.3615 22.569 99.4735 22.5898 C 99.5843 22.6109 99.7702 22.6154 100.031 22.6033 L 100.18 22.5979 C 100.441 22.5848 100.664 22.5995 100.849 22.6419 C 101.036 22.6851 101.208 22.7607 101.365 22.869 C 101.555 23.0005 101.629 23.1166 101.588 23.2174 C 101.547 23.3184 101.392 23.3959 101.126 23.4499 C 100.994 23.4766 100.861 23.4954 100.727 23.5063 C 100.593 23.5172 100.459 23.5199 100.325 23.5145 Z"/>
<path id="path1103" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 99.8967 24.1725 L 99.3444 23.7664 L 98.6096 23.915 L 98.3641 23.7312 L 99.0961 23.5838 L 98.0402 22.8073 C 97.8816 22.6906 97.7564 22.6203 97.6646 22.5963 C 97.5716 22.5724 97.4528 22.5748 97.3079 22.6032 L 96.9509 22.6734 L 96.6865 22.4755 L 97.042 22.4059 C 97.3091 22.3537 97.5392 22.3512 97.7326 22.3984 C 97.9275 22.4464 98.1472 22.5595 98.3917 22.7377 L 99.4534 23.5118 L 99.7141 23.4593 L 99.9648 23.6409 L 99.7031 23.6939 L 100.258 24.0987 Z"/>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg1442" version="1.1" viewBox="0 0 48.229092 27.352564" height="27.352564mm" width="48.229092mm">
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1" transform="translate(-84.77, -2.14013)">
<path style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="m 112.2612,24.293057 -13.426401,2.78804 -13.88065,-10.77967 11.05107,-1.80082 z" id="envelope" inkscape:connector-curvature="0" sodipodi:nodetypes="ccccc"/>
<g id="obj" transform="matrix(1.18319 0 0 1.24513 -21.0142 -3.87601)" style="stroke-width:0.823883">
<path d="M 101.293 24.8623 L 89.5613 16.2049 L 98.9014 14.7586 L 112.64 22.6231 Z" style="fill:#ff0000;stroke-width:0.823883;stop-color:#000000" id="rectangle"/>
<g transform="translate(-0.15119, -0.147829)" id="ellipse" style="stroke-width:0.823883">
<path id="path868" style="fill:#ffff00;stroke-width:0.823883;stop-color:#000000" d="M 95.2252 12.112 C 95.5786 12.0573 96.104 12.1139 96.6917 12.2708 C 97.2863 12.4294 97.9029 12.6794 98.4083 12.9687 C 99.493 13.5897 99.7779 14.2167 98.9986 14.3463 C 98.2144 14.4767 96.6999 14.0464 95.6605 13.4092 C 95.1765 13.1124 94.8651 12.8106 94.7885 12.5684 C 94.7131 12.3301 94.8708 12.1669 95.2252 12.112" transform="translate(2.5, 3)"/>
<g style="stroke-width:0.90823" transform="matrix(0.772837 0 -0.78133 1.06475 36.8685 -0.744527)" id="g877">
<path sodipodi:nodetypes="cc" id="line" d="M 87.8629 16.812 L 115.668 21.0222" style="fill:none;stroke:#000000;stroke-width:0.961211;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
</g>
</g>
<g style="font-style:normal;font-weight:normal;font-size:2.90648px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:0.179595" id="text" transform="scale(1.02584, 0.974809)" aria-label="Test">
<path id="path1097" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 97.7532 23.7569 L 94.8003 21.5211 L 95.0648 21.4713 L 96.2661 22.3746 L 98.3452 21.9741 L 98.8374 22.3253 L 96.7424 22.7328 L 98.0307 23.7015 Z"/>
<path id="path1099" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 94.4404 19.9964 L 94.575 19.972 L 96.4209 21.3159 C 96.5978 21.266 96.6599 21.1756 96.6079 21.0454 C 96.5539 20.9153 96.3904 20.7527 96.1197 20.5586 C 95.9642 20.4471 95.8018 20.3424 95.6324 20.2443 C 95.4625 20.1458 95.2821 20.0512 95.0912 19.9605 L 95.3504 19.9133 C 95.5333 20.0067 95.7108 20.1049 95.8831 20.2081 C 96.0564 20.3119 96.2219 20.42 96.3796 20.5324 C 96.779 20.8171 97.021 21.061 97.1013 21.2624 C 97.181 21.4649 97.0839 21.5931 96.8089 21.6453 C 96.524 21.6995 96.185 21.6594 95.7949 21.5257 C 95.4053 21.3921 95.0268 21.1877 94.6613 20.9148 C 94.3382 20.6736 94.16 20.4719 94.1235 20.3083 C 94.085 20.1453 94.1909 20.0417 94.4404 19.9964 Z M 94.7478 20.2953 C 94.599 20.3253 94.5378 20.3917 94.5645 20.4951 C 94.59 20.5982 94.7001 20.7221 94.8958 20.8673 C 95.1194 21.0332 95.3449 21.159 95.5715 21.2438 C 95.7978 21.328 96.0032 21.3627 96.1868 21.3475 Z"/>
<path id="path1101" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 91.7077 18.6295 L 91.9599 18.5856 C 92.0204 18.6657 92.0947 18.7473 92.1829 18.8305 C 92.2715 18.9141 92.3742 18.9992 92.4912 19.086 C 92.6704 19.2189 92.8267 19.3159 92.9594 19.3763 C 93.0912 19.4359 93.1988 19.4584 93.2816 19.4437 C 93.3446 19.4324 93.3615 19.3994 93.3323 19.3448 C 93.3022 19.2904 93.2049 19.1883 93.0413 19.0392 L 92.9376 18.9447 C 92.7227 18.7507 92.6005 18.6094 92.5692 18.5196 C 92.5358 18.4295 92.5848 18.3733 92.716 18.3505 C 92.8651 18.3246 93.0631 18.3615 93.3111 18.4616 C 93.5595 18.5614 93.8273 18.7135 94.1161 18.9193 C 94.2374 19.0058 94.3562 19.0982 94.4722 19.1966 C 94.5885 19.2943 94.7043 19.3997 94.8196 19.5128 L 94.5393 19.5632 C 94.4507 19.4526 94.352 19.3464 94.2432 19.2447 C 94.1342 19.1437 94.0144 19.0466 93.8841 18.9532 C 93.7106 18.8288 93.5568 18.7374 93.4221 18.6786 C 93.2869 18.6203 93.1806 18.598 93.1026 18.6116 C 93.0304 18.6242 93.0082 18.658 93.0361 18.7129 C 93.0628 18.7671 93.1704 18.8789 93.3604 19.0494 L 93.4662 19.1462 C 93.6602 19.3194 93.773 19.4506 93.8032 19.539 C 93.8327 19.628 93.783 19.6842 93.6542 19.7074 C 93.4974 19.7355 93.3005 19.7011 93.0646 19.6044 C 92.8301 19.5083 92.5774 19.359 92.3081 19.1579 C 92.1759 19.0592 92.0595 18.9656 91.9587 18.8769 C 91.8585 18.7887 91.7749 18.7063 91.7078 18.6296 Z"/>
<path id="path1103" style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595" d="M 90.2144 17.9758 L 90.6683 17.8985 L 89.9936 17.3953 L 90.1946 17.3616 L 90.8719 17.8638 L 91.7339 17.717 C 91.8629 17.695 91.9228 17.6645 91.9138 17.6255 C 91.9037 17.5857 91.828 17.5152 91.6876 17.4143 L 91.345 17.1685 L 91.5591 17.1326 L 91.903 17.3779 C 92.1649 17.5648 92.3103 17.7013 92.3371 17.7863 C 92.363 17.8719 92.2767 17.9318 92.0778 17.966 L 91.2104 18.1148 L 91.4607 18.3004 L 91.2548 18.3359 L 91.0055 18.1499 L 90.5486 18.2283 Z"/>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg1442"
version="1.1"
viewBox="0 0 48.229092 27.352564"
height="27.352564mm"
width="48.229092mm">
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1"
transform="translate(-84.769969,-2.1401311)">
<path
style="fill:none;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 112.2612,24.293057 -13.426401,2.78804 -13.88065,-10.77967 11.05107,-1.80082 z"
id="envelope"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<g
id="obj"
transform="matrix(1.1831883,0,0,1.2451303,-21.014249,-3.8760083)"
style="stroke-width:0.823883">
<path
d="m 114.25288,5.8730068 h 8.0941 v 9.4361272 h -8.0941 z"
style="fill:#ff0000;stroke-width:0.823883;stop-color:#000000"
id="rectangle" />
<g
transform="translate(-0.15119026,-0.14782928)"
id="ellipse"
style="stroke-width:0.823883">
<path
id="path868"
style="fill:#ffff00;stroke-width:0.823883;stop-color:#000000"
d="m 119.99817,11.072998 a 1.3420268,1.3839653 0 0 1 -1.34203,1.383965 1.3420268,1.3839653 0 0 1 -1.34202,-1.383965 1.3420268,1.3839653 0 0 1 1.34202,-1.3839652 1.3420268,1.3839653 0 0 1 1.34203,1.3839652"
transform="translate(2.5,3)" />
<g
style="stroke-width:0.90823"
transform="matrix(0.77283687,0,-0.78132957,1.0647538,36.868452,-0.74452689)"
id="g877">
<path
sodipodi:nodetypes="cc"
id="line"
d="M 116.46617,6.9686643 V 14.601442"
style="fill:none;stroke:#000000;stroke-width:0.961211;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
<g
style="font-style:normal;font-weight:normal;font-size:2.90648px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#00ff00;fill-opacity:1;stroke:none;stroke-width:0.179595"
id="text"
transform="scale(1.025842,0.97480899)"
aria-label="Test">
<path
id="path1097"
style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595"
d="m 112.48715,6.8935872 h 1.79243 v 0.2412606 h -0.75217 v 1.8775748 h -0.28809 V 7.1348478 h -0.75217 z" />
<path
id="path1099"
style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595"
d="m 115.41208,8.1523996 v 0.1277262 h -1.20063 q 0.017,0.2696442 0.16179,0.4115621 0.14618,0.1404988 0.40589,0.1404988 0.15043,0 0.29093,-0.036899 0.14192,-0.036899 0.281,-0.1106961 v 0.2469373 q -0.1405,0.059606 -0.2881,0.090828 -0.14759,0.031222 -0.29944,0.031222 -0.38034,0 -0.60316,-0.2213921 -0.22139,-0.221392 -0.22139,-0.5988938 0,-0.3902744 0.21004,-0.6187624 0.21146,-0.2299071 0.56909,-0.2299071 0.32074,0 0.50665,0.2072003 0.18733,0.205781 0.18733,0.5605759 z m -0.26113,-0.076636 q -0.003,-0.2142961 -0.12063,-0.3420223 -0.11637,-0.1277261 -0.30938,-0.1277261 -0.21855,0 -0.35054,0.1234686 -0.13056,0.1234686 -0.15043,0.347699 z" />
<path
id="path1101"
style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595"
d="m 116.85397,7.4697742 v 0.2469373 q -0.1107,-0.056767 -0.22991,-0.085151 -0.11921,-0.028384 -0.24694,-0.028384 -0.19442,0 -0.29235,0.059605 -0.0965,0.059606 -0.0965,0.1788167 0,0.090827 0.0695,0.1433371 0.0695,0.05109 0.27958,0.097923 l 0.0894,0.019869 q 0.27816,0.059605 0.39454,0.1688823 0.11779,0.1078577 0.11779,0.3022853 0,0.2213921 -0.17598,0.3505374 -0.17456,0.1291454 -0.4811,0.1291454 -0.12773,0 -0.26681,-0.025545 -0.13766,-0.024126 -0.29093,-0.073797 V 8.684592 q 0.14476,0.075217 0.28526,0.1135344 0.14049,0.036899 0.27815,0.036899 0.1845,0 0.28384,-0.062444 0.0993,-0.063863 0.0993,-0.1788167 0,-0.1064384 -0.0724,-0.1632056 -0.071,-0.056767 -0.31364,-0.1092769 l -0.0908,-0.021288 q -0.24268,-0.05109 -0.35054,-0.1561097 -0.10786,-0.1064385 -0.10786,-0.2909319 0,-0.2242304 0.15895,-0.3462798 0.15895,-0.1220495 0.4513,-0.1220495 0.14476,0 0.27248,0.021288 0.12773,0.021288 0.23559,0.063863 z" />
<path
id="path1103"
style="font-size:2.90648px;fill:#00ff00;stroke-width:0.179595"
d="m 117.61465,6.9716421 v 0.4512992 h 0.53787 V 7.625884 h -0.53787 v 0.8628612 q 0,0.1944277 0.0525,0.2497757 0.0539,0.055348 0.21713,0.055348 h 0.26823 v 0.2185537 h -0.26823 q -0.30228,0 -0.41724,-0.1121152 Q 117.3521,8.786773 117.3521,8.4887452 V 7.625884 h -0.19159 V 7.4229413 h 0.19159 V 6.9716421 Z" />
</g>
</g>
</g>
</svg>
......@@ -189,7 +189,7 @@ class RectTest(ElementTestCase):
"""Composed transformation"""
self.assertEqual(self.elem.transform, Transform('rotate(16.097889)'))
self.assertEqual(str(self.elem.composed_transform()),
'matrix(0.754465 -0.863362 1.13818 1.31905 -461.593 215.192)')
'matrix(1.4019 -0.812338 1.20967 0.709877 -542.221 533.431)')
def test_effetive_stylesheet(self):
"""Test the non-parent combination of styles"""
......
......@@ -8,3 +8,8 @@ class PathEnvelopeTest(ComparisonMixin, TestCase):
effect_class = Envelope
comparisons = [('--id=text', '--id=envelope')]
compare_file = 'svg/perspective.svg'
class PathEnvelopeGroupTest(ComparisonMixin, TestCase):
effect_class = Envelope
comparisons = [('--id=obj', '--id=envelope')]
compare_file = 'svg/perspective_groups.svg'
......@@ -8,3 +8,8 @@ class PerspectiveBasicTest(ComparisonMixin, TestCase):
effect_class = Perspective
comparisons = [('--id=text', '--id=envelope')]
compare_file = 'svg/perspective.svg'
class PerspectiveGroupTest(ComparisonMixin, TestCase):
effect_class = Perspective
comparisons = [('--id=obj', '--id=envelope')]
compare_file = 'svg/perspective_groups.svg'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment