8 |
|
|
9 |
|
|
10 |
""" |
""" |
11 |
Classes needed to write a session in SVG format |
Classes needed to write a session in SVG format. |
12 |
""" |
""" |
13 |
|
|
14 |
# For compatibility with python 2.2 |
# For compatibility with python 2.2 |
52 |
# Some pseudo classes to be compatible with the Baserenderer-class. |
# Some pseudo classes to be compatible with the Baserenderer-class. |
53 |
# |
# |
54 |
class Point: |
class Point: |
55 |
"""A simple Point class.""" |
"""Simple Point class to save x,y coordinates.""" |
56 |
def __init__(self, xp=0, yp=0): |
def __init__(self, xp=0, yp=0): |
|
"""Init the point object.""" |
|
57 |
self.x = xp |
self.x = xp |
58 |
self.y = yp |
self.y = yp |
59 |
|
|
60 |
class Trafo: |
class Trafo: |
61 |
"""Class for tranformation properties transfer.""" |
"""Class for transformation properties transfer.""" |
62 |
def __init__(self): |
def __init__(self): |
|
"""Initialize the class.""" |
|
63 |
self.trafos = [] |
self.trafos = [] |
64 |
|
|
65 |
def Append(self, type, coeffs): |
def Append(self, type, coeffs): |
77 |
else: return None |
else: return None |
78 |
|
|
79 |
class Pattern: |
class Pattern: |
|
"""Pattern object """ |
|
80 |
def __init__(self, solid=1): |
def __init__(self, solid=1): |
|
"""Init the Pattern object.""" |
|
81 |
self.solid = solid |
self.solid = solid |
82 |
|
|
83 |
class Pen: |
class Pen: |
90 |
self.cap = 'round' |
self.cap = 'round' |
91 |
|
|
92 |
def GetColor(self): |
def GetColor(self): |
|
"""Return the pen's color.""" |
|
93 |
return self.color |
return self.color |
94 |
|
|
95 |
def GetWidth(self): |
def GetWidth(self): |
|
"""Return the pen's width.""" |
|
96 |
return self.width |
return self.width |
97 |
|
|
98 |
def GetJoin(self): |
def GetJoin(self): |
|
"""Return the pen's join type.""" |
|
99 |
return self.join |
return self.join |
100 |
|
|
101 |
def GetCap(self): |
def GetCap(self): |
|
"""Return the pen's cap type.""" |
|
102 |
return self.cap |
return self.cap |
103 |
|
|
104 |
def GetDashes(self): |
def GetDashes(self): |
|
"""Return the pen's dashes.""" |
|
105 |
if self.dashes is None or self.dashes is SOLID: |
if self.dashes is None or self.dashes is SOLID: |
106 |
return [] |
return [] |
107 |
else: return self.dashes |
else: return self.dashes |
114 |
self.pattern = bpattern |
self.pattern = bpattern |
115 |
|
|
116 |
def GetColor(self): |
def GetColor(self): |
|
"""Return the brush color.""" |
|
117 |
return self.fill |
return self.fill |
118 |
|
|
119 |
def GetPattern(self): |
def GetPattern(self): |
|
"""Return the Brush pattern object.""" |
|
120 |
return self.pattern |
return self.pattern |
121 |
|
|
122 |
class Font: |
class Font: |