Example #1
0
        public string createArt(int popSize, int genCount)
        {
            string result = "";

            for (int i = 0; i < genCount; i++)
            {
                result = runGA(popSize);
            }
            Canvas             canvas = sombrero.GenotypeToPhenotype(ga.bestSolutionSoFar);
            RenderTargetBitmap rtb    = null;

            ArtEvaluator.ConvertFEtoRTB(canvas, ref rtb);
            genWindow.Background = new ImageBrush(rtb);
            CreateSaveBitmap(canvas, DateTime.Now.Ticks.ToString() + ".png");
            return(result);
        }
Example #2
0
        public string plotGA()
        {
            Canvas canvas = sombrero.GenotypeToPhenotype(ga.bestSolutionSoFar);

            //Rectangle rectangle = new Rectangle();
            //Canvas.SetLeft(rectangle, 0);
            //Canvas.SetTop(rectangle, 0);
            //rectangle.Width = ArtEvaluator.targetBitmap.Width;
            //rectangle.Height = ArtEvaluator.targetBitmap.Height;
            //rectangle.Stroke = Brushes.Black;
            //rectangle.StrokeThickness = 5.0;
            //canvas.Children.Add(rectangle);
            //mainWindow.Content = canvas;

            RenderTargetBitmap rtb = null;

            ArtEvaluator.ConvertFEtoRTB(canvas, ref rtb);
            genWindow.Background = new ImageBrush(rtb);
            return("GA Plotted");
        }