Esempio n. 1
0
        /// <summary>
        /// Render the given demo plot and save it as a PNG file
        /// </summary>
        public void CreateImage(IPlotDemo recipe)
        {
            string imageFilePath = $"{outputFolder}/images/{recipe.id}.png";

            if (recipe is IBitmapDemo bmpDemo)
            {
                System.Drawing.Bitmap bmp = bmpDemo.Render(width, height);
                bmp.Save(imageFilePath, System.Drawing.Imaging.ImageFormat.Png);
            }
            else
            {
                var plt = new Plot(width, height);
                recipe.Render(plt);
                plt.SaveFig(imageFilePath);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Render the given demo plot and save it as a PNG file
        /// </summary>
        public void CreateImage(IPlotDemo recipe)
        {
            string imageFilePath = $"{outputFolder}/images/{recipe.id}.png";

            if (recipe is IBitmapDemo bmpDemo)
            {
                System.Drawing.Bitmap bmp = bmpDemo.Render(width, height);
                bmp.Save(imageFilePath, System.Drawing.Imaging.ImageFormat.Png);
            }
            else
            {
                Plot plt;
                if (recipe.categoryMinor == "AllColormaps" || recipe.categoryMinor == "CustomColormap")
                {
                    plt = new Plot(width, 100);
                }
                else
                {
                    plt = new Plot(width, height);
                }
                recipe.Render(plt);
                plt.SaveFig(imageFilePath);
            }
        }