예제 #1
0
        public void Test_against_DataSet(int version, TriStateMatrix expected)
        {
            TriStateMatrix target = new TriStateMatrix(expected.Width);

            PositioninngPatternBuilder.EmbedBasicPatterns(version, target);
            expected.AssertEquals(target);
        }
예제 #2
0
        private void Test_One_Case(int version, TriStateMatrix expected)
        {
            TriStateMatrix target = new TriStateMatrix(expected.Width);

            PositioninngPatternBuilder.EmbedBasicPatterns(version, target);
            target.EmbedVersionInformation(version);

            expected.AssertEquals(target);
        }
예제 #3
0
        private void Test_One_Case(int version, MaskPatternType patternType, TriStateMatrix expected)
        {
            TriStateMatrix target = new TriStateMatrix(expected.Width);

            PositioninngPatternBuilder.EmbedBasicPatterns(version, target);
            PatternFactory pf = new PatternFactory();
            Pattern        pt = pf.CreateByType(patternType);

            target.EmbedFormatInformation(ErrorCorrectionLevel.H, pt);

            expected.AssertEquals(target);
        }
예제 #4
0
        private void Test_One_Case(int version, TriStateMatrix expected, IEnumerable <bool> codewords)
        {
            BitList dcList = new BitList();

            dcList.Add(codewords);

            TriStateMatrix target = new TriStateMatrix(expected.Width);

            PositioninngPatternBuilder.EmbedBasicPatterns(version, target);
            target.TryEmbedCodewords(dcList);

            expected.AssertEquals(target);
        }
예제 #5
0
        private static BitMatrix ProcessEncodationResult(EncodationStruct encodeStruct, ErrorCorrectionLevel errorLevel)
        {
            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());
            triMatrix.TryEmbedCodewords(codewords);

            return(triMatrix.GetLowestPenaltyMatrix(errorLevel));
        }
예제 #6
0
        /// <summary>
        /// Encodes the specified content.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="errorLevel">The error level.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        internal static BitMatrix Encode(string content, ErrorCorrectionLevel errorLevel)
        {
            EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel);

            BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail);

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

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

            triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version);
            triMatrix.EmbedFormatInformation(errorLevel, new Pattern0());
            triMatrix.TryEmbedCodewords(codewords);

            return(triMatrix.GetLowestPenaltyMatrix(errorLevel));
        }
예제 #7
0
        private void Encode(string content, int option)
        {
            ErrorCorrectionLevel errorLevel = ErrorCorrectionLevel.H;

            EncodationStruct encodeStruct = DataEncode.Encode(content, errorLevel);

            BitList codewords = ECGenerator.FillECCodewords(encodeStruct.DataCodewords, encodeStruct.VersionDetail);

            if (option == 3)
            {
                return;
            }

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

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

            triMatrix.EmbedVersionInformation(encodeStruct.VersionDetail.Version);
            triMatrix.EmbedFormatInformation(errorLevel, new Pattern0());
            triMatrix.TryEmbedCodewords(codewords);

            triMatrix.GetLowestPenaltyMatrix(errorLevel);
        }