zxingwp7.common.BitArray.reverse C# (CSharp) Method

reverse() public method

Reverses all bits in the array.
public reverse ( ) : void
return void
        public void reverse()
        {
            var newBits = new int[bits.Length];
            int size = this.size;
            for (int i = 0; i < size; i++)
            {
                if (get_Renamed(size - i - 1))
                {
                    newBits[i >> 5] |= 1 << (i & 0x1F);
                }
            }
            bits = newBits;
        }

Usage Example

Example #1
0
        /// <summary> Identify where the end of the middle / payload section ends.
        /// 
        /// </summary>
        /// <param name="row">row of black/white values to search
        /// </param>
        /// <returns> Array, containing index of start of 'end block' and end of 'end
        /// block'
        /// </returns>
        /// <throws>  ReaderException </throws>
        internal int[] decodeEnd(BitArray row)
        {
            // For convenience, reverse the row and then
            // search from 'the start' for the end block
            row.reverse();
            try
            {
                int endStart = skipWhiteSpace(row);
                int[] endPattern = findGuardPattern(row, endStart, END_PATTERN_REVERSED);

                // The start & end patterns must be pre/post fixed by a quiet zone. This
                // zone must be at least 10 times the width of a narrow line.
                // ref: http://www.barcode-1.net/i25code.html
                validateQuietZone(row, endPattern[0]);

                // Now recalculate the indices of where the 'endblock' starts & stops to
                // accommodate
                // the reversed nature of the search
                int temp = endPattern[0];
                endPattern[0] = row.Size - endPattern[1];
                endPattern[1] = row.Size - temp;

                return endPattern;
            }
            finally
            {
                // Put the row back the right way.
                row.reverse();
            }
        }