Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions QRCoder/ASCIIQRCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
88 changes: 44 additions & 44 deletions QRCoderTests/AsciiQRCodeRendererTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ public void can_render_small_ascii_qrcode()
var targetCode = """
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █▀▄█ ▀█ ▄▄▄▄▄ ████
████ █ █ █▄█ █▄█ █ █ ████
████ █▄▄▄█ █▄▀▀▀▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █ ▀▄█▄▄▄▄▄▄▄████
████ ▄▄ █▄ ██▀ ▄▄▄▀ ▀ ▄▀████
████▀█▄█ █▄ ▀▄▀ █▄█▄▄█████
█████▄▄▄▄█▄▄▄████▀▀ █▄█▄████
████ ▄▄▄▄▄ █▄▄█▄▄▀ ▀ ▄█▄▄████
████ █ █ █ ▀ █▄▀█ ██▄█▄████
████ █▄▄▄█ █ ▀▄▀ █▄█▄ █ ▄████
████▄▄▄▄▄▄▄█▄▄▄█████▄█▄▄████
████ ▄▄▄▄▄ █ █▄▀█ ▄▄▄▄▄ ████
████ █ █ █ █▄█ █ █ ████
████ █▄▄▄█ █▄▄▄▄▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████
████▀▄▄█▄▀▄▄██ ▄▄█ █▄ ▄ ████
████▀▀▄▄█ ▄ ▀██▀█▄▄▄▀▄████
█████▄▄██▄▄█ █▄▀█▀▄▀▄▀▄▄█████
████ ▄▄▄▄▄ █▄▀▄▄▀ ▄ ▀▀▄██████
████ █ █ █▄ ▄█▄▄ ▄██ ▀▄████
████ █▄▄▄█ █ █▄█▀█▄█▀▀ ████
████▄▄▄▄▄▄▄██▄██▄█▄█▄█▄▄████
█████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
""";
Expand All @@ -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
Expand All @@ -104,17 +104,17 @@ public void can_render_small_ascii_qrcode_inverted()
var targetCode = """


█▀▀▀▀▀█ ▄▀ █▄ █▀▀▀▀▀█
█ ███ █ █ ▀ █ ███ █
█ ▀▀▀ █ ▀▄▄▄▄ █ ▀▀▀ █
▀▀▀▀▀▀▀ █ █▄▀ ▀▀▀▀▀▀▀
██▀▀█ ▀█ ▄█▀▀▀▄█▄█▀▄
▀ █ ▀██▀█▄▀▄█ ▀ ▀▀
▀▀▀▀ ▀▀▀ ▄▄██ ▀ ▀
█▀▀▀▀▀█ ▀▀ ▀▀▄█▄█▀ ▀▀
█ ███ █ █▄█ ▀▄ █ ▀
█ ▀▀▀ █ █▄▀▄█ ▀ ▀█ █▀
▀▀▀▀▀▀▀ ▀▀▀ ▀ ▀
█▀▀▀▀▀█ ██ ▀▄ █▀▀▀▀▀█
█ ███ █ █ ▀ █ ███ █
█ ▀▀▀ █ ▀▀▀▀▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ █▄█▄█ ▀▀▀▀▀▀▀
▄▀▀ ▀▄▀▀ █▀▀ █ ▀█▀██
▄▀▀ █▀█▄█▀█ ▄ ▀▀▀▄▀
▀▀ ▀▀ █ ▀▄ ▄▀▄▀▄▀▀
█▀▀▀▀▀█ ▀▄▀▀▄█▀█▄▄▀
█ ███ █ ▀█▀ ▀▀█▀ █▄
█ ▀▀▀ █ ██ ▀ ▄ ▀ ▄▄█
▀▀▀▀▀▀▀ ▀ ▀ ▀ ▀ ▀


""";
Expand All @@ -132,17 +132,17 @@ public void can_render_small_ascii_qrcode_with_custom_eol()
var targetCode = """
█████████████████████████████
█████████████████████████████
████ ▄▄▄▄▄ █▀▄█ ▀█ ▄▄▄▄▄ ████
████ █ █ █▄█ █▄█ █ █ ████
████ █▄▄▄█ █▄▀▀▀▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ █ ▀▄█▄▄▄▄▄▄▄████
████ ▄▄ █▄ ██▀ ▄▄▄▀ ▀ ▄▀████
████▀█▄█ █▄ ▀▄▀ █▄█▄▄█████
█████▄▄▄▄█▄▄▄████▀▀ █▄█▄████
████ ▄▄▄▄▄ █▄▄█▄▄▀ ▀ ▄█▄▄████
████ █ █ █ ▀ █▄▀█ ██▄█▄████
████ █▄▄▄█ █ ▀▄▀ █▄█▄ █ ▄████
████▄▄▄▄▄▄▄█▄▄▄█████▄█▄▄████
████ ▄▄▄▄▄ █ █▄▀█ ▄▄▄▄▄ ████
████ █ █ █ █▄█ █ █ ████
████ █▄▄▄█ █▄▄▄▄▄█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀ ▀ █▄▄▄▄▄▄▄████
████▀▄▄█▄▀▄▄██ ▄▄█ █▄ ▄ ████
████▀▀▄▄█ ▄ ▀██▀█▄▄▄▀▄████
█████▄▄██▄▄█ █▄▀█▀▄▀▄▀▄▄█████
████ ▄▄▄▄▄ █▄▀▄▄▀ ▄ ▀▀▄██████
████ █ █ █▄ ▄█▄▄ ▄██ ▀▄████
████ █▄▄▄█ █ █▄█▀█▄█▀▀ ████
████▄▄▄▄▄▄▄██▄██▄█▄█▄█▄▄████
█████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
""";
Expand Down