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