Exemple #1
0
        public static bool CreateTriStateMatrix(bool[,] internalArray, out TriStateMatrix triStateMatrix)
        {
            triStateMatrix = null;
            if (internalArray == null)
            {
                return(false);
            }

            if (internalArray.GetLength(0) == internalArray.GetLength(1))
            {
                triStateMatrix = new TriStateMatrix(internalArray);
                return(true);
            }
            else
            {
                return(false);
            }
        }
        private static BitMatrix ProcessEncodationResult(EncodationStruct encodeStruct, ErrorCorrectionLevel errorLevel, MaskPatternType maskPatternType = MaskPatternType.Type5)
        {
            BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail);

            TriStateMatrix triMatrix = new TriStateMatrix(encodeStruct.VersionDetail.MatrixWidth);

            PositioninngPatternBuilder.EmbedBasicPatterns(encodeStruct.VersionDetail.Version, triMatrix);
            triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version);



            // triMatrix.EmbedFormatInformation(errorLevel, new Pattern0());
            Pattern pattern = new PatternFactory().CreateByType(maskPatternType);


            triMatrix.EmbedFormatInformation(errorLevel, pattern);
            triMatrix.TryEmbedCodewords(codewords);

            return(triMatrix.GetLowestPenaltyMatrix(errorLevel, pattern));
        }