Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
####################################################################################################
#
# Patro - A Python library to make patterns for fashion design
# Copyright (C) 2017 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
####################################################################################################
"""This modules implements the `SVG <https://www.w3.org/Graphics/SVG>`_ file format.
References:
* `SVG 1.1 (Second Edition) W3C Recommendation 16 August 2011 <https://www.w3.org/TR/SVG11>`_
"""
####################################################################################################
__all__ = [
'Svg',
'Anchor',
'AltGlyph',
'AltGlyphDef',
'AltGlyphItem',
'Animate',
'AnimateMotion',
'AnimateTransform',
'Circle',
'ClipPath',
'ColorProfile',
'Cursor',
'Defs',
'Desc',
'Ellipse',
'FeBlend',
'Group',
'Image',
'Line',
'LinearGradient',
'Marker',
'Mask',
'Path',
'Pattern',
'Polyline',
'Polygon',
'RadialGradient',
'Rect',
'Stop',
'Text',
'TextRef',
'TextSpan',
'Use',
]
####################################################################################################
from Patro.Common.Xml.Objectivity import (
# BoolAttribute,
IntAttribute, FloatAttribute,
FloatListAttribute,
StringAttribute,
XmlObjectAdaptator,
TextXmlObjectAdaptator,
# Fixme: should we mix SVG format and ... ???
from Patro.GeometryEngine.Path import Path2D
from Patro.GeometryEngine.Transformation import AffineTransformation2D
####################################################################################################
_module_logger = logging.getLogger(__name__)
####################################################################################################
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
def split_space_list(value):
return [x for x in value.split(' ') if x]
####################################################################################################
#
# Conditional Processing Attributes
# requiredFeatures
# requiredExtensions
# systemLanguage
#
####################################################################################################
####################################################################################################
#
# Core Attribute
# id
# xml:base
# xml:lang
# xml:space
#
####################################################################################################
class IdMixin:
"""Core attribute"""
__attributes__ = (
StringAttribute('id'),
)
####################################################################################################
#
# Graphical Event Attributes
# onactivate
# onclick
# onfocusin
# onfocusout
# onload
# onmousedown
# onmousemove
# onmouseout
# onmouseover
# onmouseup
#
####################################################################################################
####################################################################################################
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
class PresentationAttributes:
# https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute
# Fixme: type !!!
alignment_baseline = None # check
baseline_shift = None # check
clip = None # check
clip_path = None # check
clip_rule = None # check
color = None # check
color_interpolation = None # check
color_interpolation_filters = None # check
color_profile = None # check
color_rendering = None # check
cursor = None # check
direction = None # check
display = None # check
dominant_baseline = None # check
enable_background = None # check
fill = None
fill_opacity = 1
fill_rule = 'nonzero'
#! filter = None # check
flood_color = None # check
flood_opacity = None # check
font_family = None # check
font_size = None # check
font_size_adjust = None # check
font_stretch = None # check
font_style = None # check
font_variant = None # check
font_weight = None # check
glyph_orientation_horizontal = None # check
glyph_orientation_vertical = None # check
image_rendering = None # check
kerning = None # check
letter_spacing = None # check
lighting_color = None # check
marker_end = None # check
marker_mid = None # check
marker_start = None # check
mask = None # check
opacity = 1
overflow = None # check
paint_order = None
pointer_events = None # check
shape_rendering = None # check
stop_color = None # check
stop_opacity = None # check
stroke = None
stroke_dasharray = None # check
stroke_dashoffset = None # check
stroke_linecap = 'butt'
stroke_linejoin = 'miter'
stroke_miterlimit = 4
stroke_opacity = 1
stroke_width = 1 # px
style = None
text_anchor = None # check
text_decoration = None # check
Loading full blame...