Beispiel #1
0
        /// <summary>
        /// Exports the specified plot model to a bitmap.
        /// </summary>
        /// <param name="model">The plot model.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="background">The background.</param>
        /// <param name="resolution">The resolution (dpi).</param>
        /// <returns>A bitmap.</returns>
        public static IBitmap ExportToBitmap(
            IPlotModel model,
            int width,
            int height,
            OxyColor background,
            int resolution = 96)
        {
            var exporter = new PngExporter {
                Width = width, Height = height, Background = background, Resolution = resolution
            };

            return(exporter.ExportToBitmap(model));
        }
        /// <summary>
        /// Renders the PlotView to a bitmap.
        /// </summary>
        /// <returns>A bitmap.</returns>
        public IBitmap ToBitmap()
        {
            var background = ActualModel.Background.IsVisible() ? ActualModel.Background : Background.ToOxyColor();

            return(PngExporter.ExportToBitmap(ActualModel, (int)Bounds.Width, (int)Bounds.Height, background));
        }