/// <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); }
/// <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); } }
/// <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); }
/// <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); }
/// <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); }