summaryrefslogtreecommitdiff
path: root/gerber/render/render.py
diff options
context:
space:
mode:
authorHamilton Kibbe <hamilton.kibbe@gmail.com>2019-01-26 13:52:32 -0500
committerGitHub <noreply@github.com>2019-01-26 13:52:32 -0500
commitf59d78b7fe92fffcc0afc56c5bec1dd211cc30c6 (patch)
tree37ea4ae8f0c6936ec7d525c8da19d102f00ae0e9 /gerber/render/render.py
parent292f74dee92bc8c11e7ad51864ee96c411d14094 (diff)
parent5245fb925684b4ebe056e6509bfeca6b167903b5 (diff)
downloadgerbonara-f59d78b7fe92fffcc0afc56c5bec1dd211cc30c6.tar.gz
gerbonara-f59d78b7fe92fffcc0afc56c5bec1dd211cc30c6.tar.bz2
gerbonara-f59d78b7fe92fffcc0afc56c5bec1dd211cc30c6.zip
Merge pull request #92 from curtacircuitos/subclass-bugfix
Fix hard requirement of cairo per #83, and add stubs for required sub…
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