From: d Date: Tue, 9 Nov 2010 05:10:07 +0000 (-0400) Subject: add 4-unit margin and white background X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2ad66965120e177c5b0abdd783fc43d6a599bbda;p=inkscape.git add 4-unit margin and white background --- diff --git a/share/extensions/render_barcode_qrcode.py b/share/extensions/render_barcode_qrcode.py index 7b6759c0f..6a34f9671 100644 --- a/share/extensions/render_barcode_qrcode.py +++ b/share/extensions/render_barcode_qrcode.py @@ -119,13 +119,22 @@ class QRCode: return pattern def makeSVG(self, grp, boxsize): - pixelsize = self.getModuleCount() * boxsize - + margin = 4 + pixelsize = (self.getModuleCount() + 2*margin) * boxsize #self.getModuleCount() * boxsize + + # white background providing margin: + rect = inkex.etree.SubElement(grp, inkex.addNS('rect', 'svg')) + rect.set('x', '0') + rect.set('y', '0') + rect.set('width', str(pixelsize)) + rect.set('height', str(pixelsize)) + rect.set('style', 'fill:white;stroke:none') + for r in range(self.getModuleCount()): for c in range(self.getModuleCount()): if (self.isDark(r, c) ): - x = c * boxsize - y = r * boxsize + x = (c + margin) * boxsize + y = (r + margin) * boxsize rect = inkex.etree.SubElement(grp, inkex.addNS('rect', 'svg')) rect.set('x', str(x)) rect.set('y', str(y))