summaryrefslogtreecommitdiff
path: root/gerbonara/gerber/render/cairo_backend.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-06-13 22:15:05 +0200
committerjaseg <git@jaseg.de>2021-06-13 22:15:05 +0200
commit66da2d165481d3e0c5c153a788b26aa23cc0ad97 (patch)
treeaa4f2b85ad14cc64d63f6b53fa2e8a4724b6f291 /gerbonara/gerber/render/cairo_backend.py
parentd0f836ecfadacbaea20fc6a3ceebd455e96e1307 (diff)
downloadgerbonara-66da2d165481d3e0c5c153a788b26aa23cc0ad97.tar.gz
gerbonara-66da2d165481d3e0c5c153a788b26aa23cc0ad97.tar.bz2
gerbonara-66da2d165481d3e0c5c153a788b26aa23cc0ad97.zip
Fix hole transparency in aperture macros
Diffstat (limited to 'gerbonara/gerber/render/cairo_backend.py')
-rw-r--r--gerbonara/gerber/render/cairo_backend.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gerbonara/gerber/render/cairo_backend.py b/gerbonara/gerber/render/cairo_backend.py
index d9c197d..6af3348 100644
--- a/gerbonara/gerber/render/cairo_backend.py
+++ b/gerbonara/gerber/render/cairo_backend.py
@@ -513,9 +513,21 @@ class GerberCairoContext(GerberContext):
self.ctx.mask_surface(mask.surface, self.origin_in_pixels[0])
def _render_amgroup(self, amgroup, color):
+
+ mask_surface = cairo.SVGSurface(None, self.size_in_pixels[0], self.size_in_pixels[1])
+ mask_ctx = cairo.Context(mask_surface)
+ mask_ctx.set_matrix(self.ctx.get_matrix())
+
+ old_surface, self.surface = self.surface, mask_surface
+ old_ctx, self.ctx = self.ctx, mask_ctx
+
for primitive in amgroup.primitives:
self.render(primitive)
+ old_ctx.mask_surface(mask_surface, self.origin_in_pixels[0])
+ mask_surface.finish()
+ self.surface, self.ctx = old_surface, old_ctx
+
def _render_test_record(self, primitive, color):
position = [pos + origin for pos, origin in
zip(primitive.position, self.origin_in_inch)]