[svgLib] Add support for polyline element
This commit is contained in:
parent
d5adee46d9
commit
8d9a935eaa
@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
def _prefer_non_zero(*args):
|
def _prefer_non_zero(*args):
|
||||||
for arg in args:
|
for arg in args:
|
||||||
if arg != 0:
|
if arg != 0:
|
||||||
@ -123,6 +124,10 @@ class PathBuilder(object):
|
|||||||
self._start_path('M' + poly.attrib['points'])
|
self._start_path('M' + poly.attrib['points'])
|
||||||
self._end_path()
|
self._end_path()
|
||||||
|
|
||||||
|
def _parse_polyline(self, poly):
|
||||||
|
if 'points' in poly.attrib:
|
||||||
|
self._start_path('M' + poly.attrib['points'])
|
||||||
|
|
||||||
def _parse_circle(self, circle):
|
def _parse_circle(self, circle):
|
||||||
cx = float(circle.attrib.get('cx', 0))
|
cx = float(circle.attrib.get('cx', 0))
|
||||||
cy = float(circle.attrib.get('cy', 0))
|
cy = float(circle.attrib.get('cy', 0))
|
||||||
|
@ -58,6 +58,12 @@ import pytest
|
|||||||
"M30,10 50,30 10,30 z",
|
"M30,10 50,30 10,30 z",
|
||||||
None
|
None
|
||||||
),
|
),
|
||||||
|
# polyline
|
||||||
|
(
|
||||||
|
"<polyline points='30,10 50,30 10,30'/>",
|
||||||
|
"M30,10 50,30 10,30",
|
||||||
|
None
|
||||||
|
),
|
||||||
# circle, minimal valid example
|
# circle, minimal valid example
|
||||||
(
|
(
|
||||||
"<circle r='1'/>",
|
"<circle r='1'/>",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user