public Image Generate(ref List <RGB> Classes, uint height, uint width) { uint NumofClasses = (uint)Classes.Count; Image img = new Image(width, height, 3, 4); Pixel P = new Pixel(); uint Workingsegment = width / NumofClasses; int WorkingClass = 0; for (uint w = 0; w < width; ++w) { if (w == Workingsegment && WorkingClass < NumofClasses - 1) { ++WorkingClass; Workingsegment += width / NumofClasses; img.AddClass(w); } for (uint h = 0; h < height; ++h) { P.R = BoundaryCheck(Classes[WorkingClass].RMeau + GetNextRandom() * Classes[WorkingClass].RSigma); P.G = BoundaryCheck(Classes[WorkingClass].GMeau + GetNextRandom() * Classes[WorkingClass].GSigma); P.B = BoundaryCheck(Classes[WorkingClass].BMeau + GetNextRandom() * Classes[WorkingClass].BSigma); img.SetPixel(w, h, ref P); } } return(img); }