Exemplo n.º 1
0
        /// <summary>
        /// Exports the specified plot model to a stream.
        /// </summary>
        /// <param name="model">The model to export.</param>
        /// <param name="stream">The stream.</param>
        /// <param name="width">The width of the output bitmap.</param>
        /// <param name="height">The height of the output bitmap.</param>
        /// <param name="background">The background color. The default value is <c>null</c>.</param>
        /// <param name="resolution">The resolution (resolution). The default value is 96.</param>
        public static void Export(PlotModel model, Stream stream, int width, int height, OxyColor background, int resolution = 96)
        {
            var exporter = new PngExporter {
                Width = width, Height = height, Background = background, Resolution = resolution
            };

            exporter.Export(model, stream);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Exports the specified plot model to a file.
        /// </summary>
        /// <param name="model">The model to export.</param>
        /// <param name="fileName">The file name.</param>
        /// <param name="width">The width of the output bitmap.</param>
        /// <param name="height">The height of the output bitmap.</param>
        /// <param name="background">The background color. The default value is <c>null</c>.</param>
        /// <param name="resolution">The resolution (resolution). The default value is 96.</param>
        public static void Export(IPlotModel model, string fileName, int width, int height, OxyColor background, double resolution = 96)
        {
            var exporter = new PngExporter {
                Width = width, Height = height, Background = background, Resolution = resolution
            };

            using (var stream = File.Create(fileName))
            {
                exporter.Export(model, stream);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Saves the PlotView as a bitmap.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        public void SaveBitmap(string fileName, int width, int height)
        {
            if (width <= 0)
            {
                width = (int)this.ActualWidth;
            }

            if (height <= 0)
            {
                height = (int)this.ActualHeight;
            }

            PngExporter.Export(this.ActualModel, fileName, width, height);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Saves the PlotView as a bitmap.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="background">The background.</param>
        public void SaveBitmap(string fileName, int width, int height, OxyColor background)
        {
            if (width == 0)
            {
                width = (int)this.ActualWidth;
            }

            if (height == 0)
            {
                height = (int)this.ActualHeight;
            }

            if (background.IsAutomatic())
            {
                background = this.Background.ToOxyColor();
            }

            PngExporter.Export(this.ActualModel, fileName, width, height, background);
        }
Exemplo n.º 5
-1
 /// <summary>
 /// Exports the specified plot model to a stream.
 /// </summary>
 /// <param name="model">The model to export.</param>
 /// <param name="stream">The stream.</param>
 /// <param name="width">The width of the output bitmap.</param>
 /// <param name="height">The height of the output bitmap.</param>
 /// <param name="background">The background color. The default value is <c>null</c>.</param>
 /// <param name="resolution">The resolution (resolution). The default value is 96.</param>
 public static void Export(PlotModel model, Stream stream, int width, int height, OxyColor background, int resolution = 96)
 {
     var exporter = new PngExporter { Width = width, Height = height, Background = background, Resolution = resolution };
     exporter.Export(model, stream);
 }