ZXing.QrCode.Internal.Version.getECBlocksForLevel C# (CSharp) Method

getECBlocksForLevel() public method

public getECBlocksForLevel ( ErrorCorrectionLevel ecLevel ) : ECBlocks
ecLevel ErrorCorrectionLevel
return ECBlocks
        public ECBlocks getECBlocksForLevel(ErrorCorrectionLevel ecLevel)
        {
            return ecBlocks[ecLevel.ordinal()];
        }

Usage Example

Esempio n. 1
0
        /// <summary></summary>
        /// <returns>true if the number of input bits will fit in a code with the specified version and error correction level.</returns>
        private static bool willFit(int numInputBits, Version version, ErrorCorrectionLevel ecLevel)
        {
            // In the following comments, we use numbers of Version 7-H.
            // numBytes = 196
            var numBytes = version.TotalCodewords;
            // getNumECBytes = 130
            var ecBlocks   = version.getECBlocksForLevel(ecLevel);
            var numEcBytes = ecBlocks.TotalECCodewords;
            // getNumDataBytes = 196 - 130 = 66
            var numDataBytes    = numBytes - numEcBytes;
            var totalInputBytes = (numInputBits + 7) / 8;

            return(numDataBytes >= totalInputBytes);
        }
All Usage Examples Of ZXing.QrCode.Internal.Version::getECBlocksForLevel