/// <summary> /// Saves the <see cref="Viewport3D" /> to a bitmap. /// </summary> /// <param name="view">The view.</param> /// <param name="stream">The output stream.</param> /// <param name="background">The background brush.</param> /// <param name="m">The oversampling multiplier.</param> /// <param name="format">The output format.</param> public static void SaveBitmap(this Viewport3D view, Stream stream, Brush background = null, int m = 1, BitmapExporter.OutputFormat format = BitmapExporter.OutputFormat.Png) { var exporter = new BitmapExporter { Background = background, OversamplingMultiplier = m, Format = format }; exporter.Export(view, stream); }
/// <summary> /// Saves the viewport to a file. /// </summary> /// <param name="view">The view.</param> /// <param name="fileName">Name of the file.</param> /// <param name="background">The background brush.</param> /// <param name="m">The oversampling multiplier.</param> public static void SaveBitmap(Viewport3D view, string fileName, Brush background = null, int m = 1) { var exporter = new BitmapExporter(fileName) { Background = background, OversamplingMultiplier = m }; exporter.Export(view); }