Exemplo n.º 1
0
        private void SetupTypeInfo(bool test, int maskPattern)
        {
            int data        = this.errorCorrectLevel << 3 | maskPattern;
            int bCHTypeInfo = QRUtil.GetBCHTypeInfo(data);

            for (int i = 0; i < 15; i++)
            {
                bool value = !test && (bCHTypeInfo >> i & 1) == 1;
                if (i < 6)
                {
                    this.modules[i][8] = new bool?(value);
                }
                else
                {
                    if (i < 8)
                    {
                        this.modules[i + 1][8] = new bool?(value);
                    }
                    else
                    {
                        this.modules[this.moduleCount - 15 + i][8] = new bool?(value);
                    }
                }
            }
            for (int j = 0; j < 15; j++)
            {
                bool value2 = !test && (bCHTypeInfo >> j & 1) == 1;
                if (j < 8)
                {
                    this.modules[8][this.moduleCount - j - 1] = new bool?(value2);
                }
                else
                {
                    if (j < 9)
                    {
                        this.modules[8][15 - j - 1 + 1] = new bool?(value2);
                    }
                    else
                    {
                        this.modules[8][15 - j - 1] = new bool?(value2);
                    }
                }
            }
            this.modules[this.moduleCount - 8][8] = new bool?(!test);
        }
Exemplo n.º 2
0
        private void SetupTypeInfo(bool test, int maskPattern)
        {
            int data = (errorCorrectLevel << 3) | maskPattern;
            int bits = QRUtil.GetBCHTypeInfo(data);

            for (int i = 0; i < 15; i++)
            {
                bool mod = (!test && ((bits >> i) & 1) == 1);
                if (i < 6)
                {
                    modules[i][8] = mod;
                }
                else if (i < 8)
                {
                    modules[i + 1][8] = mod;
                }
                else
                {
                    modules[moduleCount - 15 + i][8] = mod;
                }
            }

            for (int i = 0; i < 15; i++)
            {
                bool mod = (!test && ((bits >> i) & 1) == 1);
                if (i < 8)
                {
                    modules[8][moduleCount - i - 1] = mod;
                }
                else if (i < 9)
                {
                    modules[8][15 - i - 1 + 1] = mod;
                }
                else
                {
                    modules[8][15 - i - 1] = mod;
                }
            }

            modules[moduleCount - 8][8] = !test;
        }