private static void DrawRect(ModuleBlock modules, int row, int col, int width, int height, ModuleFlag type, bool xor = false) { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { modules.Set(row + i, col + j, type, !xor); } } }
private void PopulateReservedModuleBits() { // This isn't the most efficient way to fill in the template, but it's only // performed once, then cached. So speed isn't a huge issue. // Fill in timing pattern in row 6 and col 6. // ISO/IEC 18004:2006(E), Sec. 5.3.4 for (int i = 0; i < Width; i++) { ModuleFlag moduleFlag = ModuleFlag.Reserved | ((i % 2 == 0) ? ModuleFlag.Dark : ModuleFlag.Light); _modules.Set(i, 6, moduleFlag, overwrite: true); _modules.Set(6, i, moduleFlag, overwrite: true); } // Fill in the finder patterns (the "QR" patterns) PopulateFinderPatterns(); // Fill in alignment patterns (the smaller "QR" patterns throughout the encoding region) PopulateAlignmentPatterns(); // Fill in version information (next to the finder pattern) PopulateVersionInformation(); }