Пример #1
0
 protected void RenderPopulation()
 {
     Genome1.Source = CPPNRenderEngine.Render(population[0, 0], CPPNSettings.ThumbnailWidth, CPPNSettings.ThumbnailHeight);
     Genome2.Source = CPPNRenderEngine.Render(population[0, 1], CPPNSettings.ThumbnailWidth, CPPNSettings.ThumbnailHeight);
     Genome3.Source = CPPNRenderEngine.Render(population[1, 0], CPPNSettings.ThumbnailWidth, CPPNSettings.ThumbnailHeight);
     Genome4.Source = CPPNRenderEngine.Render(population[1, 1], CPPNSettings.ThumbnailWidth, CPPNSettings.ThumbnailHeight);
 }
Пример #2
0
        protected void SaveImage(CPPNetwork n)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (sfd.ShowDialog() ?? true)
            {
                IsEnabled = false;

                var encoder = new PngBitmapEncoder();

                encoder.Frames.Add(BitmapFrame.Create((BitmapSource)CPPNRenderEngine.Render(n, CPPNSettings.RenderWidth, CPPNSettings.RenderHeight)));

                using (var stream = sfd.OpenFile())
                {
                    encoder.Save(stream);
                }

                IsEnabled = true;
            }
        }