Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/svg_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'svg_utils.py')
-rw-r--r--svg_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/svg_utils.py b/svg_utils.py
index 0d828c6..2e02b5e 100644
--- a/svg_utils.py
+++ b/svg_utils.py
@@ -12,6 +12,7 @@
# Boston, MA 02111-1307, USA.
import gtk
+from math import sin, cos, pi
def generate_xo_svg(scale=1.0, colors=["#C0C0C0", "#282828"]):
@@ -30,6 +31,19 @@ def svg_str_to_pixbuf(svg_string):
return pixbuf
+def svg_sector(x, y, r, a, fill, stroke):
+ ''' Returns an SVG sector '''
+ if a < pi:
+ big_arc = 0
+ else:
+ big_arc = 1
+ svg_string = ' <path d="M%f,%f v%f a%f,%f 0 %d,0 %f,%f z"\n' % (
+ x, y, -r, r, r, big_arc, -sin(a) * r, r - cos(a) * r)
+ svg_string += _svg_style('fill:%s;stroke:%s;' % (fill, stroke))
+ print svg_string
+ return svg_string
+
+
def svg_rect(w, h, rx, ry, x, y, fill, stroke):
''' Returns an SVG rectangle '''
svg_string = ' <rect\n'