Skip to content

Remove AddQuietZone #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 23, 2024
Merged
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
24 changes: 0 additions & 24 deletions QRCoder/QRCodeGenerator.ModulePlacer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,6 @@ public partial class QRCodeGenerator
{
private static partial class ModulePlacer
{
/// <summary>
/// Adds a quiet zone around the QR code. A quiet zone is a blank margin used to separate the QR code
/// from other visual elements, improving scanner readability. This zone consists of white modules
/// extending 4 modules wide around the existing QR code pattern.
/// </summary>
/// <param name="qrCode">The QR code data structure to modify.</param>
public static void AddQuietZone(QRCodeData qrCode)
{
// Calculate the required length for a new quiet line, including existing modules plus 8 additional for the quiet zone.
var quietLineLength = qrCode.ModuleMatrix.Count + 8;
// Add four new lines at the top of the QR code matrix to create the upper part of the quiet zone.
for (var i = 0; i < 4; i++)
qrCode.ModuleMatrix.Insert(0, new BitArray(quietLineLength));
// Add four new lines at the bottom of the QR code matrix to create the lower part of the quiet zone.
for (var i = 0; i < 4; i++)
qrCode.ModuleMatrix.Add(new BitArray(quietLineLength));
// Expand each line of the QR code matrix sideways by 4 modules on each side to complete the quiet zone.
for (var i = 4; i < qrCode.ModuleMatrix.Count - 4; i++)
{
qrCode.ModuleMatrix[i].Length += 8;
ShiftAwayFromBit0(qrCode.ModuleMatrix[i], 4);
}
}

/// <summary>
/// Places the version information on the QR code matrix for versions 7 and higher. Version information
/// is encoded into two small rectangular areas near the bottom left and top right corners outside the timing patterns.
Expand Down