diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-11-06 14:44:40 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-11-06 14:44:40 -0500 |
commit | 422c86bcc684ea94515862b0dd3a39ce0f4bd86f (patch) | |
tree | a1efe6504e40083e61dcbe412c243fd8c00628f3 /gerber/cam.py | |
parent | ede065e6d16e1e4ffe970c8b13945139b3f4bcb2 (diff) | |
parent | 22e668c75f24174d2090443ed98e804b3737bd84 (diff) | |
download | gerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.tar.gz gerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.tar.bz2 gerbonara-422c86bcc684ea94515862b0dd3a39ce0f4bd86f.zip |
Merge upstream changes
Diffstat (limited to 'gerber/cam.py')
-rw-r--r-- | gerber/cam.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gerber/cam.py b/gerber/cam.py index c5b8938..15b801a 100644 --- a/gerber/cam.py +++ b/gerber/cam.py @@ -168,7 +168,7 @@ class FileSettings(object): self.zero_suppression == other.zero_suppression and self.format == other.format and self.angle_units == other.angle_units) - + def __str__(self): return ('<Settings: %s %s %s %s %s>' % (self.units, self.notation, self.zero_suppression, self.format, self.angle_units)) @@ -256,7 +256,7 @@ class CamFile(object): def to_metric(self): pass - def render(self, ctx, invert=False, filename=None): + def render(self, ctx=None, invert=False, filename=None): """ Generate image of layer. Parameters @@ -267,7 +267,10 @@ class CamFile(object): filename : string <optional> If provided, save the rendered image to `filename` """ - ctx.set_bounds(self.bounds) + if ctx is None: + from .render import GerberCairoContext + ctx = GerberCairoContext() + ctx.set_bounds(self.bounding_box) ctx._paint_background() ctx.invert = invert ctx._new_render_layer() |