ImageManipulation.OctreeQuantizer.OctreeQuantizer C# (CSharp) Method

OctreeQuantizer() public method

Construct the octree quantizer.
The Octree quantizer is a two pass algorithm. The initial pass sets up the octree, the second pass quantizes a color based on the nodes in the tree.
public OctreeQuantizer ( int maxColors, int maxColorBits ) : System
maxColors int The maximum number of colors to return.
maxColorBits int The number of significant bits.
return System
        public OctreeQuantizer( int maxColors, int maxColorBits )
            : base( false ) {
            if( maxColors > 255 )
                throw new ArgumentOutOfRangeException( "maxColors", maxColors,
                                                       "The number of colors should be less than 256" );

            if( ( maxColorBits < 1 ) | ( maxColorBits > 8 ) )
                throw new ArgumentOutOfRangeException( "maxColorBits", maxColorBits, "This should be between 1 and 8" );

            // Construct the octree
            octree = new Octree( maxColorBits );

            this.maxColors = maxColors;
        }