private bool ProcessIteration() { if (Best.Generation == 0) { Best = new GARepresentation(WorkingImg.GetBitmap().Width, WorkingImg.GetBitmap().Height); SeedRepresentation(Best); } GARepresentation nextgen = Best.Duplicate(); nextgen.Mutate(Entropy, Properties); nextgen.DrawToFastBitmap(WorkingImg); double nextcomp = FastBitmap.UltraCompare(Img, WorkingImg); if ((nextcomp < BestComparison) || ((nextcomp == BestComparison) && (nextgen.Shapes.Count < Best.Shapes.Count))) { Best = nextgen; BestComparison = nextcomp; Best.Generation++; return(true); } return(false); }
private void UpdateBestComparison() { FastBitmap imagebitmap = new FastBitmap(CurrentProject.SourceImage.Width, CurrentProject.SourceImage.Height, PixelFormat.Format24bppRgb); CurrentProject.BestYet.DrawToFastBitmap(imagebitmap); CurrentProject.BestComparison = FastBitmap.UltraCompare(CurrentProject.SourceImage, imagebitmap); changed = true; }