diff --git a/QRCoder/ASCIIQRCode.cs b/QRCoder/ASCIIQRCode.cs index a86a9ec9..84ea3b99 100644 --- a/QRCoder/ASCIIQRCode.cs +++ b/QRCoder/ASCIIQRCode.cs @@ -102,14 +102,14 @@ public string GetGraphicSmall(bool drawQuietZones = true, bool invert = false, s { for (var col = 0; col < sideLength; col++) { - var current = moduleData[col + quietZonesOffset][row + quietZonesOffset] ^ invert; + var current = moduleData[row + quietZonesOffset][col + quietZonesOffset] ^ invert; var nextRowId = row + quietZonesOffset + 1; // Set next to whitespace "color" var next = BLACK; // Fill next with value, if in data range if (nextRowId < QrCodeData.ModuleMatrix.Count) - next = moduleData[col + quietZonesOffset][nextRowId] ^ invert; + next = moduleData[nextRowId][col + quietZonesOffset] ^ invert; if (current == WHITE && next == WHITE) lineBuilder.Append(palette.WHITE_ALL); diff --git a/QRCoderTests/AsciiQRCodeRendererTests.cs b/QRCoderTests/AsciiQRCodeRendererTests.cs index e6c52c2c..be2028cc 100644 --- a/QRCoderTests/AsciiQRCodeRendererTests.cs +++ b/QRCoderTests/AsciiQRCodeRendererTests.cs @@ -51,17 +51,17 @@ public void can_render_small_ascii_qrcode() var targetCode = """ █████████████████████████████ █████████████████████████████ - ████ ▄▄▄▄▄ █▀▄█ ▀█ ▄▄▄▄▄ ████ - ████ █ █ █▄█ █▄█ █ █ ████ - ████ █▄▄▄█ █▄▀▀▀▀█ █▄▄▄█ ████ - ████▄▄▄▄▄▄▄█ █ ▀▄█▄▄▄▄▄▄▄████ - ████ ▄▄ █▄ ██▀ ▄▄▄▀ ▀ ▄▀████ - ████▀█▄█ █▄ ▄ ▀▄▀ █▄█▄▄█████ - █████▄▄▄▄█▄▄▄████▀▀ █▄█▄████ - ████ ▄▄▄▄▄ █▄▄█▄▄▀ ▀ ▄█▄▄████ - ████ █ █ █ ▀ █▄▀█ ██▄█▄████ - ████ █▄▄▄█ █ ▀▄▀ █▄█▄ █ ▄████ - ████▄▄▄▄▄▄▄█▄▄▄█████▄█▄▄▄████ + ████ ▄▄▄▄▄ █ █▄▀█ ▄▄▄▄▄ ████ + ████ █ █ █ █▄█ █ █ █ ████ + ████ █▄▄▄█ █▄▄▄▄▄█ █▄▄▄█ ████ + ████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████ + ████▀▄▄█▄▀▄▄██ ▄▄█ █▄ ▄ ████ + ████▀▀▄▄█ ▄ ▀ ▄ ██▀█▄▄▄▀▄████ + █████▄▄██▄▄█ █▄▀█▀▄▀▄▀▄▄█████ + ████ ▄▄▄▄▄ █▄▀▄▄▀ ▄ ▀▀▄██████ + ████ █ █ █▄ ▄█▄▄ ▄██ ▀▄████ + ████ █▄▄▄█ █ ▄ █▄█▀█▄█▀▀ ████ + ████▄▄▄▄▄▄▄██▄██▄█▄█▄█▄█▄████ █████████████████████████████ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ """; @@ -78,17 +78,17 @@ public void can_render_small_ascii_qrcode() public void can_render_small_ascii_qrcode_without_quietzones() { var targetCode = """ - ▄▄▄▄▄ █▀▄█ ▀█ ▄▄▄▄▄ - █ █ █▄█ █▄█ █ █ - █▄▄▄█ █▄▀▀▀▀█ █▄▄▄█ - ▄▄▄▄▄▄▄█ █ ▀▄█▄▄▄▄▄▄▄ - ▄▄ █▄ ██▀ ▄▄▄▀ ▀ ▄▀ - ▀█▄█ █▄ ▄ ▀▄▀ █▄█▄▄█ - █▄▄▄▄█▄▄▄████▀▀ █▄█▄ - ▄▄▄▄▄ █▄▄█▄▄▀ ▀ ▄█▄▄ - █ █ █ ▀ █▄▀█ ██▄█▄ - █▄▄▄█ █ ▀▄▀ █▄█▄ █ ▄ - ▄▄▄▄▄▄▄█▄▄▄█████▄█▄▄▄ + ▄▄▄▄▄ █ █▄▀█ ▄▄▄▄▄ + █ █ █ █▄█ █ █ █ + █▄▄▄█ █▄▄▄▄▄█ █▄▄▄█ + ▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄ + ▀▄▄█▄▀▄▄██ ▄▄█ █▄ ▄ + ▀▀▄▄█ ▄ ▀ ▄ ██▀█▄▄▄▀▄ + █▄▄██▄▄█ █▄▀█▀▄▀▄▀▄▄█ + ▄▄▄▄▄ █▄▀▄▄▀ ▄ ▀▀▄██ + █ █ █▄ ▄█▄▄ ▄██ ▀▄ + █▄▄▄█ █ ▄ █▄█▀█▄█▀▀ + ▄▄▄▄▄▄▄██▄██▄█▄█▄█▄█▄ """; //Create QR code @@ -104,17 +104,17 @@ public void can_render_small_ascii_qrcode_inverted() var targetCode = """ - █▀▀▀▀▀█ ▄▀ █▄ █▀▀▀▀▀█ - █ ███ █ ▀ █ ▀ █ ███ █ - █ ▀▀▀ █ ▀▄▄▄▄ █ ▀▀▀ █ - ▀▀▀▀▀▀▀ █ █▄▀ ▀▀▀▀▀▀▀ - ██▀▀█ ▀█ ▄█▀▀▀▄█▄█▀▄ - ▄ ▀ █ ▀██▀█▄▀▄█ ▀ ▀▀ - ▀▀▀▀ ▀▀▀ ▄▄██ ▀ ▀ - █▀▀▀▀▀█ ▀▀ ▀▀▄█▄█▀ ▀▀ - █ ███ █ █▄█ ▀▄ █ ▀ ▀ - █ ▀▀▀ █ █▄▀▄█ ▀ ▀█ █▀ - ▀▀▀▀▀▀▀ ▀▀▀ ▀ ▀▀▀ + █▀▀▀▀▀█ ██ ▀▄ █▀▀▀▀▀█ + █ ███ █ █ ▀ █ █ ███ █ + █ ▀▀▀ █ ▀▀▀▀▀ █ ▀▀▀ █ + ▀▀▀▀▀▀▀ █▄█▄█ ▀▀▀▀▀▀▀ + ▄▀▀ ▀▄▀▀ █▀▀ █ ▀█▀██ + ▄▄▀▀ █▀█▄█▀█ ▄ ▀▀▀▄▀ + ▀▀ ▀▀ █ ▀▄ ▄▀▄▀▄▀▀ + █▀▀▀▀▀█ ▀▄▀▀▄█▀█▄▄▀ + █ ███ █ ▀█▀ ▀▀█▀ █▄▀ + █ ▀▀▀ █ █▀█ ▀ ▄ ▀ ▄▄█ + ▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀ ▀ """; @@ -132,17 +132,17 @@ public void can_render_small_ascii_qrcode_with_custom_eol() var targetCode = """ █████████████████████████████ █████████████████████████████ - ████ ▄▄▄▄▄ █▀▄█ ▀█ ▄▄▄▄▄ ████ - ████ █ █ █▄█ █▄█ █ █ ████ - ████ █▄▄▄█ █▄▀▀▀▀█ █▄▄▄█ ████ - ████▄▄▄▄▄▄▄█ █ ▀▄█▄▄▄▄▄▄▄████ - ████ ▄▄ █▄ ██▀ ▄▄▄▀ ▀ ▄▀████ - ████▀█▄█ █▄ ▄ ▀▄▀ █▄█▄▄█████ - █████▄▄▄▄█▄▄▄████▀▀ █▄█▄████ - ████ ▄▄▄▄▄ █▄▄█▄▄▀ ▀ ▄█▄▄████ - ████ █ █ █ ▀ █▄▀█ ██▄█▄████ - ████ █▄▄▄█ █ ▀▄▀ █▄█▄ █ ▄████ - ████▄▄▄▄▄▄▄█▄▄▄█████▄█▄▄▄████ + ████ ▄▄▄▄▄ █ █▄▀█ ▄▄▄▄▄ ████ + ████ █ █ █ █▄█ █ █ █ ████ + ████ █▄▄▄█ █▄▄▄▄▄█ █▄▄▄█ ████ + ████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████ + ████▀▄▄█▄▀▄▄██ ▄▄█ █▄ ▄ ████ + ████▀▀▄▄█ ▄ ▀ ▄ ██▀█▄▄▄▀▄████ + █████▄▄██▄▄█ █▄▀█▀▄▀▄▀▄▄█████ + ████ ▄▄▄▄▄ █▄▀▄▄▀ ▄ ▀▀▄██████ + ████ █ █ █▄ ▄█▄▄ ▄██ ▀▄████ + ████ █▄▄▄█ █ ▄ █▄█▀█▄█▀▀ ████ + ████▄▄▄▄▄▄▄██▄██▄█▄█▄█▄█▄████ █████████████████████████████ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ """;