diff options
author | Paulo Henrique Silva <ph.silva@gmail.com> | 2015-07-09 04:05:15 -0300 |
---|---|---|
committer | Paulo Henrique Silva <ph.silva@gmail.com> | 2015-07-09 04:05:15 -0300 |
commit | b3f6ec558ca35a19bd60440f2a114eb98c0a4263 (patch) | |
tree | f59df1ac2080b60567ba7893ae4bee677588ab26 | |
parent | 5aaf18889c3cdc31ae61b9593bf5848bc57ec09a (diff) | |
download | gerbonara-b3f6ec558ca35a19bd60440f2a114eb98c0a4263.tar.gz gerbonara-b3f6ec558ca35a19bd60440f2a114eb98c0a4263.tar.bz2 gerbonara-b3f6ec558ca35a19bd60440f2a114eb98c0a4263.zip |
Fix arcs and ackground painting
-rw-r--r-- | gerber/cam.py | 4 | ||||
-rw-r--r-- | gerber/render/cairo_backend.py | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gerber/cam.py b/gerber/cam.py index 91ffb9a..804e366 100644 --- a/gerber/cam.py +++ b/gerber/cam.py @@ -253,9 +253,11 @@ class CamFile(object): filename : string <optional> If provided, save the rendered image to `filename` """ + ctx._paint_background() + if ctx.invert: ctx._paint_inverted_layer() - + for p in self.primitives: ctx.render(p) if filename is not None: diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py index 939863b..16638f5 100644 --- a/gerber/render/cairo_backend.py +++ b/gerber/render/cairo_backend.py @@ -72,7 +72,7 @@ class GerberCairoContext(GerberContext): center = map(mul, arc.center, self.scale)
start = map(mul, arc.start, self.scale)
end = map(mul, arc.end, self.scale)
- radius = self.scale * arc.radius
+ radius = self.scale[0] * arc.radius
angle1 = arc.start_angle
angle2 = arc.end_angle
width = arc.aperture.diameter if arc.aperture.diameter != 0 else 0.001
@@ -139,6 +139,10 @@ class GerberCairoContext(GerberContext): self.ctx.paint()
self.ctx.set_operator(cairo.OPERATOR_CLEAR)
+ def _paint_background(self):
+ self.ctx.set_source_rgba(*self.background_color)
+ self.ctx.paint()
+
def dump(self, filename):
is_svg = filename.lower().endswith(".svg")
|