From 66da2d165481d3e0c5c153a788b26aa23cc0ad97 Mon Sep 17 00:00:00 2001 From: jaseg Date: Sun, 13 Jun 2021 22:15:05 +0200 Subject: Fix hole transparency in aperture macros --- gerbonara/gerber/render/cairo_backend.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gerbonara/gerber/render') 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)] -- cgit