Closed GregoryHarrison closed 2 years ago
I have extended the default moduledrawers.py to add a SpriteModuleDrawer (requires import math):
class SpriteModuleDrawer(QRModuleDrawer): """ Draws the modules as small circles (sprites) """ circle = None def initialize(self, styledPilImage, image): box_size = styledPilImage.box_size fake_size = box_size * ANTIALIASING_FACTOR sprite_size = math.ceil(fake_size / 1.6) self.circle = Image.new(styledPilImage.mode,(fake_size, fake_size), styledPilImage.color_mask.back_color) ImageDraw.Draw(self.circle).ellipse((0,0, sprite_size, sprite_size), fill = styledPilImage.paint_color) self.circle = self.circle.resize((box_size, box_size), Image.LANCZOS) self.image = image def drawrect_context(self, box, is_active, context): if is_active: self.image.paste(self.circle, (box[0][0], box[0][1]))
I am unclear on if/how such custom moduledrawers can be applied to SVG output?
I have extended the default moduledrawers.py to add a SpriteModuleDrawer (requires import math):
I am unclear on if/how such custom moduledrawers can be applied to SVG output?