Example #1
0
        //get logical center coordinates of each alignment patterns
        public static Point[][] getLogicalCenter(FinderPattern finderPattern)
        {
            int version = finderPattern.Version;

            Point[][] logicalCenters = new Point[1][];
            for (int i = 0; i < 1; i++)
            {
                logicalCenters[i] = new Point[1];
            }
            int[] logicalSeeds = new int[1];
            //create "column(row)-coordinates" which based on relative coordinates
            //int sqrtCenters = (version / 7) + 2;
            //logicalSeeds = new int[sqrtCenters];
            //for(int i=0 ; i<sqrtCenters ; i++) {
            //	logicalSeeds[i] = 6 + i * (4 + 4 * version) / (sqrtCenters - 1);
            //	logicalSeeds[i] -= (logicalSeeds[i] - 2) % 4;
            //}
            logicalSeeds   = LogicalSeed.getSeed(version);
            logicalCenters = new Point[logicalSeeds.Length][];
            for (int i2 = 0; i2 < logicalSeeds.Length; i2++)
            {
                logicalCenters[i2] = new Point[logicalSeeds.Length];
            }

            //create real relative coordinates
            for (int col = 0; col < logicalCenters.Length; col++)
            {
                for (int row = 0; row < logicalCenters.Length; row++)
                {
                    logicalCenters[row][col] = new Point(logicalSeeds[row], logicalSeeds[col]);
                }
            }
            return(logicalCenters);
        }
Example #2
0
        internal virtual void  initialize()
        {
            //calculate version by number of side modules
            version = (width - 17) / 4;
            Point[][] alignmentPattern = new Point[1][];
            for (int i = 0; i < 1; i++)
            {
                alignmentPattern[i] = new Point[1];
            }

            int[] logicalSeeds = new int[1];
            if (version >= 2 && version <= 40)
            {
                logicalSeeds = LogicalSeed.getSeed(version);
                Point[][] tmpArray = new Point[logicalSeeds.Length][];
                for (int i2 = 0; i2 < logicalSeeds.Length; i2++)
                {
                    tmpArray[i2] = new Point[logicalSeeds.Length];
                }
                alignmentPattern = tmpArray;
            }

            //obtain alignment pattern's center coodintates by logical seeds
            for (int col = 0; col < logicalSeeds.Length; col++)
            {
                for (int row = 0; row < logicalSeeds.Length; row++)
                {
                    alignmentPattern[row][col] = new Point(logicalSeeds[row], logicalSeeds[col]);
                }
            }
            this.alignmentPattern = alignmentPattern;
            dataCapacity          = calcDataCapacity();
            bool[] formatInformation = readFormatInformation();
            decodeFormatInformation(formatInformation);
            unmask();
        }