summaryrefslogtreecommitdiff
path: root/gerber/render/svgwrite_backend.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-13 09:37:27 -0500
committerHamilton Kibbe <hamilton.kibbe@gmail.com>2015-02-13 09:37:27 -0500
commit5e23d07bcb5103b4607c6ad591a2a547c97ee1f6 (patch)
treefdc7989cc6d4fe200d61267b6b9c228dcce44c2c /gerber/render/svgwrite_backend.py
parent8f69c1dfa281b6486c8fce16c1d58acef70c7ae7 (diff)
downloadgerbonara-5e23d07bcb5103b4607c6ad591a2a547c97ee1f6.tar.gz
gerbonara-5e23d07bcb5103b4607c6ad591a2a547c97ee1f6.tar.bz2
gerbonara-5e23d07bcb5103b4607c6ad591a2a547c97ee1f6.zip
Fix rendering for line with rectangular aperture per #12. Still need to do the same for arcs.
Diffstat (limited to 'gerber/render/svgwrite_backend.py')
-rw-r--r--gerber/render/svgwrite_backend.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/gerber/render/svgwrite_backend.py b/gerber/render/svgwrite_backend.py
index 279d90f..9e6a5e4 100644
--- a/gerber/render/svgwrite_backend.py
+++ b/gerber/render/svgwrite_backend.py
@@ -68,8 +68,14 @@ class GerberSvgContext(GerberContext):
aline.stroke(opacity=self.alpha)
self.dwg.add(aline)
elif isinstance(line.aperture, Rectangle):
- # TODO: Render rectangle strokes as a polygon...
- pass
+ points = [tuple(map(mul, point, self.scale)) for point in line.vertices]
+ path = self.dwg.path(d='M %f, %f' % points[0],
+ fill=svg_color(color),
+ stroke='none')
+ path.fill(opacity=self.alpha)
+ for point in points[1:]:
+ path.push('L %f, %f' % point)
+ self.dwg.add(path)
def _render_arc(self, arc, color):
start = tuple(map(mul, arc.start, self.scale))