summaryrefslogtreecommitdiff
path: root/gerber/render/cairo_backend.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/cairo_backend.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/cairo_backend.py')
-rw-r--r--gerber/render/cairo_backend.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/gerber/render/cairo_backend.py b/gerber/render/cairo_backend.py
index b450be0..7c01319 100644
--- a/gerber/render/cairo_backend.py
+++ b/gerber/render/cairo_backend.py
@@ -91,7 +91,7 @@ class GerberCairoContext(GerberContext):
self.set_bounds(bounds)
else:
self.set_bounds(layer.bounds)
- self._paint_background(bgsettings)
+ self.paint_background(bgsettings)
if verbose:
print('[Render]: Rendering {} Layer.'.format(layer.layer_class))
self._render_count += 1
@@ -193,11 +193,11 @@ class GerberCairoContext(GerberContext):
def _render_layer(self, layer, settings):
self.invert = settings.invert
# Get a new clean layer to render on
- self._new_render_layer(mirror=settings.mirror)
+ self.new_render_layer(mirror=settings.mirror)
for prim in layer.primitives:
self.render(prim)
# Add layer to image
- self._flatten(settings.color, settings.alpha)
+ self.flatten(settings.color, settings.alpha)
def _render_line(self, line, color):
start = self.scale_point(line.start)
@@ -530,7 +530,7 @@ class GerberCairoContext(GerberContext):
self.ctx.show_text(primitive.net_name)
self.ctx.scale(1, -1)
- def _new_render_layer(self, color=None, mirror=False):
+ def new_render_layer(self, color=None, mirror=False):
size_in_pixels = self.scale_point(self.size_in_inch)
matrix = cairo.Matrix() * self._xform_matrix
layer = cairo.SVGSurface(None, size_in_pixels[0], size_in_pixels[1])
@@ -548,8 +548,7 @@ class GerberCairoContext(GerberContext):
self.active_layer = layer
self.active_matrix = matrix
-
- def _flatten(self, color=None, alpha=None):
+ def flatten(self, color=None, alpha=None):
color = color if color is not None else self.color
alpha = alpha if alpha is not None else self.alpha
self.output_ctx.set_source_rgba(color[0], color[1], color[2], alpha)
@@ -558,7 +557,7 @@ class GerberCairoContext(GerberContext):
self.active_layer = None
self.active_matrix = None
- def _paint_background(self, settings=None):
+ def paint_background(self, settings=None):
color = settings.color if settings is not None else self.background_color
alpha = settings.alpha if settings is not None else 1.0
if not self.has_bg: