diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-03-05 22:42:42 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2015-03-05 22:42:42 -0500 |
commit | 68619d4d5a7beb38dc81d953b43bf4196ca1d3a6 (patch) | |
tree | dbc6a5ebe7403c95d9c37b0ef338d4eb60e4980a /gerber/render/cairo_backend.py | |
parent | c40683b6a216f29fe473c31680ade7ab294002cd (diff) | |
download | gerbonara-68619d4d5a7beb38dc81d953b43bf4196ca1d3a6.tar.gz gerbonara-68619d4d5a7beb38dc81d953b43bf4196ca1d3a6.tar.bz2 gerbonara-68619d4d5a7beb38dc81d953b43bf4196ca1d3a6.zip |
Fix parsing for multiline ipc-d-356 records
Diffstat (limited to 'gerber/render/cairo_backend.py')
-rw-r--r-- | gerber/render/cairo_backend.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py index 326f44e..fa1aecc 100644 --- a/gerber/render/cairo_backend.py +++ b/gerber/render/cairo_backend.py @@ -104,7 +104,7 @@ class GerberCairoContext(GerberContext): self.ctx.fill()
def _render_circle(self, circle, color):
- center = map(mul, circle.position, self.scale)
+ center = tuple(map(mul, circle.position, self.scale))
self.ctx.set_source_rgba(*color, alpha=self.alpha)
self.ctx.set_line_width(0)
self.ctx.arc(*center, radius=circle.radius * SCALE, angle1=0, angle2=2 * math.pi)
@@ -126,5 +126,15 @@ class GerberCairoContext(GerberContext): def _render_drill(self, circle, color):
self._render_circle(circle, color)
+ def _render_test_record(self, primitive, color):
+ self.ctx.select_font_face('monospace', cairo.FONT_SLANT_NORMAL, cairo.FONT_WEIGHT_NORMAL)
+ self.ctx.set_font_size(200)
+ self._render_circle(Circle(primitive.position, 0.01), color)
+ self.ctx.set_source_rgb(*color)
+ self.ctx.move_to(*[SCALE * (coord + 0.01) for coord in primitive.position])
+ self.ctx.scale(1, -1)
+ self.ctx.show_text(primitive.net_name)
+ self.ctx.scale(1, -1)
+
def dump(self, filename):
self.surface.write_to_png(filename)
|