diff --git a/QRCoder/ArtQRCode.cs b/QRCoder/ArtQRCode.cs index c1964c93..79a2eddc 100644 --- a/QRCoder/ArtQRCode.cs +++ b/QRCoder/ArtQRCode.cs @@ -59,13 +59,13 @@ public Bitmap GetGraphic(Bitmap backgroundImage = null) /// Style of the background image (if set). Fill=spanning complete graphic; DataAreaOnly=Don't paint background into quietzone /// Optional image that should be used instead of the default finder patterns /// QRCode graphic as bitmap - public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor, Color backgroundColor, Bitmap backgroundImage = null, double pixelSizeFactor = 0.8, + public Bitmap GetGraphic(int pixelsPerModule, Color darkColor, Color lightColor, Color backgroundColor, Bitmap backgroundImage = null, double pixelSizeFactor = 1, bool drawQuietZones = true, QuietZoneStyle quietZoneRenderingStyle = QuietZoneStyle.Dotted, BackgroundImageStyle backgroundImageStyle = BackgroundImageStyle.DataAreaOnly, Bitmap finderPatternImage = null) { if (pixelSizeFactor > 1) throw new Exception("The parameter pixelSize must be between 0 and 1. (0-100%)"); - int pixelSize = (int)Math.Min(pixelsPerModule, Math.Floor(pixelsPerModule / pixelSizeFactor)); + int pixelSize = (int)Math.Min(pixelsPerModule, Math.Floor(pixelsPerModule * pixelSizeFactor)); var numModules = QrCodeData.ModuleMatrix.Count - (drawQuietZones ? 0 : 8); var offset = (drawQuietZones ? 0 : 4); @@ -283,7 +283,7 @@ public static class ArtQRCodeHelper /// Optional image that should be used instead of the default finder patterns /// QRCode graphic as bitmap public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color darkColor, Color lightColor, Color backgroundColor, ECCLevel eccLevel, bool forceUtf8 = false, - bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, Bitmap backgroundImage = null, double pixelSizeFactor = 0.8, + bool utf8BOM = false, EciMode eciMode = EciMode.Default, int requestedVersion = -1, Bitmap backgroundImage = null, double pixelSizeFactor = 1.0, bool drawQuietZones = true, QuietZoneStyle quietZoneRenderingStyle = QuietZoneStyle.Flat, BackgroundImageStyle backgroundImageStyle = BackgroundImageStyle.DataAreaOnly, Bitmap finderPatternImage = null) { @@ -295,4 +295,4 @@ public static Bitmap GetQRCode(string plainText, int pixelsPerModule, Color dark } } -#endif \ No newline at end of file +#endif diff --git a/QRCoderTests/ArtQRCodeRendererTests.cs b/QRCoderTests/ArtQRCodeRendererTests.cs index 6657a7f4..b5734eed 100644 --- a/QRCoderTests/ArtQRCodeRendererTests.cs +++ b/QRCoderTests/ArtQRCodeRendererTests.cs @@ -83,9 +83,9 @@ public void should_throw_pixelfactor_oor_exception() [Category("QRRenderer/ArtQRCode")] public void can_instantate_parameterless() { - var asciiCode = new ArtQRCode(); - asciiCode.ShouldNotBeNull(); - asciiCode.ShouldBeOfType(); + var artCode = new ArtQRCode(); + artCode.ShouldNotBeNull(); + artCode.ShouldBeOfType(); } [Fact] @@ -94,7 +94,6 @@ public void can_render_artqrcode_from_helper() { //Create QR code var bmp = ArtQRCodeHelper.GetQRCode("A", 10, Color.Black, Color.White, Color.Transparent, QRCodeGenerator.ECCLevel.L); - var result = HelperFunctions.BitmapToHash(bmp); result.ShouldBe("57ecaa9bdeadcdcbeac8a19d734907ff"); }