コード例 #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));
        }
コード例 #2
0
        /// <summary>
        /// Saves the PlotView as a bitmap.
        /// </summary>
        /// <param name="stream">Stream to which to write the bitmap.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="background">The background.</param>
        public void SaveBitmap(Stream stream, int width, int height, OxyColor background)
        {
            if (width <= 0)
            {
                width = (int)Bounds.Width;
            }

            if (height <= 0)
            {
                height = (int)Bounds.Height;
            }

            if (!background.IsVisible())
            {
                background = Background.ToOxyColor();
            }

            PngExporter.Export(ActualModel, stream, width, height, background);
        }
コード例 #3
0
        /// <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));
        }