Exemple #1
0
        public BitSquare Build(string data)
        {
            if (data == null)
            {
                throw new ArgumentNullException(nameof(data));
            }

            var qr = new QRCodeInternal(TypeNumber, ErrorCorrectLevel);

            qr.AddData(data);
            qr.Make();

            var moduleCount = qr.ModuleCount;
            var bits        = new BitSquare(moduleCount);

            for (var r = 0; r < moduleCount; r++)
            {
                for (var c = 0; c < moduleCount; c++)
                {
                    bits[r, c] = qr.IsDark(r, c);
                }
            }

            return(bits);
        }
Exemple #2
0
 public void CopyTo(BitSquare other)
 {
     for (int r = 0; r < RowCount && r < other.RowCount; r++)
     {
         for (int c = 0; c < ColumnCount && c < other.ColumnCount; c++)
         {
             if (_values[r, c] >= 0)
             {
                 other._values[r, c] = true;
             }
             else
             {
                 other._values[r, c] = false;
             }
         }
     }
 }