int RGB; // 0 - R, 1 - G, 2 - B public ColNode(int RGB, Color separat) { this.RGB = RGB; this.separat = separat; left = right = null; child = new List <Col>(); }
public ColNode AddLeft(int level) { int newrgb = (RGB); if (left == null) { Color nC = Color.FromArgb(separat.R - ((newrgb == 0) ? 255 / (int)Math.Pow(2, level) : 0), separat.G - ((newrgb == 1) ? 255 / (int)Math.Pow(2, level) : 0), separat.B - ((newrgb == 2) ? 255 / (int)Math.Pow(2, level) : 0)); left = new ColNode(newrgb, nC); } return(left); }
public ColNode AddRight(int level) { int newrgb = (RGB); if (right == null) { Color nC = Color.FromArgb(separat.R + ((newrgb == 0) ? 255 / (int)Math.Pow(2, level) : 0), separat.G + ((newrgb == 1) ? 255 / (int)Math.Pow(2, level) : 0), separat.B + ((newrgb == 2) ? 255 / (int)Math.Pow(2, level) : 0)); right = new ColNode(newrgb, nC); } return(right); }