diff options
author | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-01-21 03:57:44 -0500 |
---|---|---|
committer | Hamilton Kibbe <hamilton.kibbe@gmail.com> | 2016-01-21 03:57:44 -0500 |
commit | 5476da8aa3f4ee424f56f4f2491e7af1c4b7b758 (patch) | |
tree | 427dafda78ee21a1846a2b9c9747dd96afe7e8a3 /gerber/render/render.py | |
parent | 7a532514631384dbfc9d7fc2002cbbfe52433c9f (diff) | |
download | gerbonara-5476da8aa3f4ee424f56f4f2491e7af1c4b7b758.tar.gz gerbonara-5476da8aa3f4ee424f56f4f2491e7af1c4b7b758.tar.bz2 gerbonara-5476da8aa3f4ee424f56f4f2491e7af1c4b7b758.zip |
Fix a bunch of rendering bugs.
- 'clear' polarity primitives no longer erase background
- Added aperture macro support for polygons
- Added aperture macro rendring support
- Renderer now creates a new surface for each layer and merges them instead of working
directly on a single surface
- Updated examples accordingly
Diffstat (limited to 'gerber/render/render.py')
-rw-r--r-- | gerber/render/render.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gerber/render/render.py b/gerber/render/render.py index 6af8bf1..d7a62e1 100644 --- a/gerber/render/render.py +++ b/gerber/render/render.py @@ -57,12 +57,14 @@ class GerberContext(object): alpha : float Rendering opacity. Between 0.0 (transparent) and 1.0 (opaque.) """ + def __init__(self, units='inch'): self._units = units self._color = (0.7215, 0.451, 0.200) self._background_color = (0.0, 0.0, 0.0) self._alpha = 1.0 self._invert = False + self.ctx = None @property def units(self): @@ -132,8 +134,7 @@ class GerberContext(object): self._invert = invert def render(self, primitive): - color = (self.color if primitive.level_polarity == 'dark' - else self.background_color) + color = self.color if isinstance(primitive, Line): self._render_line(primitive, color) elif isinstance(primitive, Arc): @@ -155,6 +156,7 @@ class GerberContext(object): else: return + def _render_line(self, primitive, color): pass @@ -184,9 +186,9 @@ class GerberContext(object): class RenderSettings(object): + def __init__(self, color=(0.0, 0.0, 0.0), alpha=1.0, invert=False, mirror=False): self.color = color self.alpha = alpha self.invert = invert self.mirror = mirror - |