Example #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="e"></param>
        /// <param name="oldBlue"></param>
        /// <param name="newBlue"></param>
        /// <returns>Returns true if enumerator has ended</returns>
        private bool InsertData(IEnumerator e, byte oldBlue,
            out byte newBlue)
        {
            bool end = e.MoveNext();
            if (!end)
            {
                newBlue = oldBlue;
                return true;
            }
            var x1 = (bool)e.Current;
            e.MoveNext();
            var x2 = (bool)e.Current;

            var blueBits = new BitArray(new[] { oldBlue });

            var a1 = blueBits[0];
            var a2 = blueBits[1];
            var a3 = blueBits[2];
            var t1 = (x1 == a1 ^ a3);
            var t2 = (x2 == a2 ^ a3);
            if (t1 && t2)
            {
            }
            if (!t1 && t2)
            {
                blueBits[0] = !blueBits[0];
            }
            if (t1 && !t2)
            {
                blueBits[1] = !blueBits[1];
            }
            if (!t1 && !t2)
            {
                blueBits[2] = !blueBits[2];
            }

            newBlue = blueBits.ConvertColorBitsToByte();
            return false;
        }