Exemple #1
0
        private Version(int versionNumber,
                        int symbolSizeRows,
                        int symbolSizeColumns,
                        int dataRegionSizeRows,
                        int dataRegionSizeColumns,
                        ECBlocks ecBlocks)
        {
            this.versionNumber         = versionNumber;
            this.symbolSizeRows        = symbolSizeRows;
            this.symbolSizeColumns     = symbolSizeColumns;
            this.dataRegionSizeRows    = dataRegionSizeRows;
            this.dataRegionSizeColumns = dataRegionSizeColumns;
            this.ecBlocks = ecBlocks;

            // Calculate the total number of codewords
            int total       = 0;
            int ecCodewords = ecBlocks.getECCodewords();

            ECB[] ecbArray = ecBlocks.getECBlocks();
            for (int i = 0; i < ecbArray.Length; i++)
            {
                ECB ecBlock = ecbArray[i];
                total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
            }
            this.totalCodewords = total;
        }
Exemple #2
0
        private Version(int versionNumber,
                        int[] alignmentPatternCenters,
                        ECBlocks ecBlocks1,
                        ECBlocks ecBlocks2,
                        ECBlocks ecBlocks3,
                        ECBlocks ecBlocks4)
        {
            this.versionNumber           = versionNumber;
            this.alignmentPatternCenters = alignmentPatternCenters;
            this.ecBlocks = new ECBlocks[] { ecBlocks1, ecBlocks2, ecBlocks3, ecBlocks4 };
            int total       = 0;
            int ecCodewords = ecBlocks1.getECCodewordsPerBlock();

            ECB[] ecbArray = ecBlocks1.getECBlocks();
            for (int i = 0; i < ecbArray.Length; i++)
            {
                ECB ecBlock = ecbArray[i];
                total += ecBlock.getCount() * (ecBlock.getDataCodewords() + ecCodewords);
            }
            this.totalCodewords = total;
        }