|
|
@ -149,11 +149,6 @@ namespace ImageProcessorCore.Quantizers |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
private readonly int maxColorBits; |
|
|
private readonly int maxColorBits; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Number of leaves in the tree
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private int leafCount; |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Store the last node quantized
|
|
|
/// Store the last node quantized
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
@ -173,7 +168,7 @@ namespace ImageProcessorCore.Quantizers |
|
|
public Octree(int maxColorBits) |
|
|
public Octree(int maxColorBits) |
|
|
{ |
|
|
{ |
|
|
this.maxColorBits = maxColorBits; |
|
|
this.maxColorBits = maxColorBits; |
|
|
this.leafCount = 0; |
|
|
this.Leaves = 0; |
|
|
this.reducibleNodes = new OctreeNode[9]; |
|
|
this.reducibleNodes = new OctreeNode[9]; |
|
|
this.root = new OctreeNode(0, this.maxColorBits, this); |
|
|
this.root = new OctreeNode(0, this.maxColorBits, this); |
|
|
this.previousColor = 0; |
|
|
this.previousColor = 0; |
|
|
@ -183,11 +178,7 @@ namespace ImageProcessorCore.Quantizers |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Gets or sets the number of leaves in the tree
|
|
|
/// Gets or sets the number of leaves in the tree
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public int Leaves |
|
|
private int Leaves { get; set; } |
|
|
{ |
|
|
|
|
|
get { return this.leafCount; } |
|
|
|
|
|
set { this.leafCount = value; } |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Gets the array of reducible nodes
|
|
|
/// Gets the array of reducible nodes
|
|
|
@ -292,7 +283,7 @@ namespace ImageProcessorCore.Quantizers |
|
|
this.reducibleNodes[index] = node.NextReducible; |
|
|
this.reducibleNodes[index] = node.NextReducible; |
|
|
|
|
|
|
|
|
// Decrement the leaf count after reducing the node
|
|
|
// Decrement the leaf count after reducing the node
|
|
|
this.leafCount -= node.Reduce(); |
|
|
this.Leaves -= node.Reduce(); |
|
|
|
|
|
|
|
|
// And just in case I've reduced the last color to be added, and the next color to
|
|
|
// And just in case I've reduced the last color to be added, and the next color to
|
|
|
// be added is the same, invalidate the previousNode...
|
|
|
// be added is the same, invalidate the previousNode...
|
|
|
|