Jillzhang.GifUtility.OcTreeNode.Reduce C# (CSharp) Method

Reduce() private method

private Reduce ( ) : int
return int
        internal int Reduce()
        {
            Red = Green = Blue = 0;
            int childrenCount = 0;
            for (int i = 0; i < 8; i++)
            {
                if (Children[i] != null)
                {
                    Red += Children[i].Red;
                    Blue += Children[i].Blue;
                    Green += Children[i].Green;
                    PixelCount += Children[i].PixelCount;
                    childrenCount++;
                    Children[i] = null;
                }
            }
            Leaf = true;
            return childrenCount - 1;
        }

Usage Example

Beispiel #1
0
        void Reduce()
        {
            int index;

            for (index = _colorDepth - 1; (index > 0 && ReducibleNodes[index] == null); index--)
            {
            }
            OcTreeNode node = ReducibleNodes[index];

            ReducibleNodes[index] = node.NextReducible;
            leaves     -= node.Reduce();
            _prefixNode = null;
        }