private int GetReducedColor(int color) { OctNode node = root; while (true) { int branch = node.Branch(color); if (node.children[branch] == null) { break; } node = node.children[branch].Value; } return(node.color); }
public void InsertColor(OctNode node, int color) { if (node.LowestLevel) { node.color = color; node.PixelCount++; } else { int next = node.Branch(color); if (node.children[next] == null) { node.InitChild(next); } node.ChildrenPixelCount++; InsertColor(node.children[next].Value, color); } }