diff options
author | Garret Fick <garret@ficksworkshop.com> | 2016-03-26 15:59:42 +0800 |
---|---|---|
committer | Garret Fick <garret@ficksworkshop.com> | 2016-03-26 15:59:42 +0800 |
commit | acde19f205898188c03a46e5d8a7a6a4d4637a2d (patch) | |
tree | f1c11657ecf104fa86d33c233d2c67dd7d40cd96 /gerber/render/cairo_backend.py | |
parent | d12f6385a434c02677bfbb7b075dd9d8e49627fe (diff) | |
download | gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.tar.gz gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.tar.bz2 gerbonara-acde19f205898188c03a46e5d8a7a6a4d4637a2d.zip |
Support for the G85 slot statement
Diffstat (limited to 'gerber/render/cairo_backend.py')
-rw-r--r-- | gerber/render/cairo_backend.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py index 7be7e6a..d895e5c 100644 --- a/gerber/render/cairo_backend.py +++ b/gerber/render/cairo_backend.py @@ -173,6 +173,20 @@ class GerberCairoContext(GerberContext): def _render_drill(self, circle, color):
self._render_circle(circle, color)
+ def _render_slot(self, slot, color):
+ start = map(mul, slot.start, self.scale)
+ end = map(mul, slot.end, self.scale)
+
+ width = slot.diameter
+
+ self.ctx.set_source_rgba(color[0], color[1], color[2], self.alpha)
+ self.ctx.set_operator(cairo.OPERATOR_OVER if (slot.level_polarity == "dark" and not self.invert) else cairo.OPERATOR_CLEAR)
+ self.ctx.set_line_width(width * self.scale[0])
+ self.ctx.set_line_cap(cairo.LINE_CAP_ROUND)
+ self.ctx.move_to(*start)
+ self.ctx.line_to(*end)
+ self.ctx.stroke()
+
def _render_amgroup(self, amgroup, color):
for primitive in amgroup.primitives:
self.render(primitive)
|