summaryrefslogtreecommitdiff
path: root/gerber/render/render.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hkibbe@entic.com>2018-06-05 08:57:37 -0400
committerHamilton Kibbe <hkibbe@entic.com>2018-06-05 08:57:37 -0400
commit5245fb925684b4ebe056e6509bfeca6b167903b5 (patch)
tree56615e66b5a9a2b3e04cf58b0b94604bac7af3f4 /gerber/render/render.py
parent31062ba2ce326bf3165c15b325b31b226dc69a11 (diff)
downloadgerbonara-5245fb925684b4ebe056e6509bfeca6b167903b5.tar.gz
gerbonara-5245fb925684b4ebe056e6509bfeca6b167903b5.tar.bz2
gerbonara-5245fb925684b4ebe056e6509bfeca6b167903b5.zip
Fix hard requirement of cairo per #83, and add stubs for required subclass methods to GerberContext per #84
Diffstat (limited to 'gerber/render/render.py')
-rw-r--r--gerber/render/render.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/gerber/render/render.py b/gerber/render/render.py
index 79f43d6..580a7ea 100644
--- a/gerber/render/render.py
+++ b/gerber/render/render.py
@@ -139,7 +139,7 @@ class GerberContext(object):
if not primitive:
return
- self._pre_render_primitive(primitive)
+ self.pre_render_primitive(primitive)
color = self.color
if isinstance(primitive, Line):
@@ -167,16 +167,35 @@ class GerberContext(object):
elif isinstance(primitive, TestRecord):
self._render_test_record(primitive, color)
- self._post_render_primitive(primitive)
+ self.post_render_primitive(primitive)
- def _pre_render_primitive(self, primitive):
+ def set_bounds(self, bounds, *args, **kwargs):
+ """Called by the renderer to set the extents of the file to render.
+
+ Parameters
+ ----------
+ bounds: Tuple[Tuple[float, float], Tuple[float, float]]
+ ( (x_min, x_max), (y_min, y_max)
+ """
+ pass
+
+ def paint_background(self):
+ pass
+
+ def new_render_layer(self):
+ pass
+
+ def flatten(self):
+ pass
+
+ def pre_render_primitive(self, primitive):
"""
Called before rendering a primitive. Use the callback to perform some action before rendering
a primitive, for example adding a comment.
"""
return
- def _post_render_primitive(self, primitive):
+ def post_render_primitive(self, primitive):
"""
Called after rendering a primitive. Use the callback to perform some action after rendering
a primitive