PurplePen.OctreeQuantizer.Octree.OctreeNode.OctreeNode C# (CSharp) Method

OctreeNode() public method

Construct the node
public OctreeNode ( int level, int colorBits, Octree octree ) : System
level int The level in the tree = 0 - 7
colorBits int The number of significant color bits in the image
octree Octree The tree to which this node belongs
return System
                public OctreeNode(int level, int colorBits, Octree octree)
                {
                    // Construct the new node
                    _leaf = (level == colorBits);

                    _red = _green = _blue = 0;
                    _pixelCount = 0;

                    // If a leaf, increment the leaf count
                    if (_leaf) {
                        octree.Leaves++;
                        _nextReducible = null;
                        _children = null;
                    }
                    else {
                        // Otherwise add this to the reducible nodes
                        _nextReducible = octree.ReducibleNodes[level];
                        octree.ReducibleNodes[level] = this;
                        _children = new OctreeNode[8];
                    }
                }