Commits

Jörg Rädler committed f82063e

fixed bugs in the SVG export (color, opacity)

Comments (0)

Files changed (3)

 00.00.00
 - fixed some methods to work with instances of subclasses
+- fixed a bug in the SVG export (rgb), thanks to Diederik van Lierop
 
-29.01.12
+29.01.13
 - version 3.0.6
 - moved development from GitHub to bitbucket
 - renamed package from Polygon to Polygon3 to avoid conflicts with Polygon2
     if height and not width:
         width = height / a
     npoly = len(pp)
-    fill_color   = __RingBuffer(fill_color   or ('red', 'green', 'blue', 'yellow'))
+    fill_color   = __RingBuffer(fill_color   or ((255,0,0), (0,255,0), (0,0,255), (255,255,0)))
     fill_opacity = __RingBuffer(fill_opacity or (1.0,))
-    stroke_color = __RingBuffer(stroke_color or ('black',))
+    stroke_color = __RingBuffer(stroke_color or ((0,0,0),))
     stroke_width = __RingBuffer(stroke_width or (1.0,))
     s = ['<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>',
          '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
         bb = bbs[i]
         p.warpToBox(width*(bb[0]-minx)/xdim, width*(bb[1]-minx)/xdim,
                     height*(bb[2]-miny)/ydim, height*(bb[3]-miny)/ydim)
-        subl = ['<path style="fill:%s;fill-opacity:%s;fill-rule:evenodd;stroke:%s;stroke-width:%s;" d="' %
+        subl = ['<path style="fill:rgb%s;fill-opacity:%s;fill-rule:evenodd;stroke:rgb%s;stroke-width:%s;" d="' %
                 (fill_color(), fill_opacity(), stroke_color(), stroke_width())]
         for c in p:
             subl.append('M %g, %g %s z ' % (c[0][0], c[0][1], ' '.join([("L %g, %g" % (a,b)) for a,b in c[1:]])))
     - polylist: sequence of Polygons
     - optional width: float
     - optional height: height
-    - optional fill_color: sequence of colors (3-tuples of floats: RGB)
-    - optional fill_opacity: sequence of colors
+    - optional fill_color: sequence of colors (3-tuples of integers 0...255: RGB)
+    - optional fill_opacity: sequence of floats 0.0...1.0
     - optional stroke_color: sequence of colors
     - optional stroke_width: sequence of floats
 :Returns:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.