ZXing.QrCode.Internal.MatrixUtil.embedTypeInfo C# (CSharp) Метод

embedTypeInfo() публичный статический Метод

public static embedTypeInfo ( ErrorCorrectionLevel ecLevel, int maskPattern, ByteMatrix matrix ) : void
ecLevel ErrorCorrectionLevel
maskPattern int
matrix ByteMatrix
Результат void
        public static void embedTypeInfo(ErrorCorrectionLevel ecLevel, int maskPattern, ByteMatrix matrix)
        {
            BitArray typeInfoBits = new BitArray();
             makeTypeInfoBits(ecLevel, maskPattern, typeInfoBits);

             for (int i = 0; i < typeInfoBits.Size; ++i)
             {
            // Place bits in LSB to MSB order.  LSB (least significant bit) is the last value in
            // "typeInfoBits".
            int bit = typeInfoBits[typeInfoBits.Size - 1 - i] ? 1 : 0;

            // Type info bits at the left top corner. See 8.9 of JISX0510:2004 (p.46).
            int x1 = TYPE_INFO_COORDINATES[i][0];
            int y1 = TYPE_INFO_COORDINATES[i][1];
            matrix[x1, y1] = bit;

            if (i < 8)
            {
               // Right top corner.
               int x2 = matrix.Width - i - 1;
               int y2 = 8;
               matrix[x2, y2] = bit;
            }
            else
            {
               // Left bottom corner.
               int x2 = 8;
               int y2 = matrix.Height - 7 + (i - 8);
               matrix[x2, y2] = bit;
            }
             }
        }